Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
.DS_Store
app/.env
app/vendor
app/logs
19 changes: 19 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
**Как использовать**

1)зайти в контейнер php-fpm через команду docker-compose exec php-fpm bash
2)зайти в директорию public
3)запустить скрипт через команду php index.php

index.php принимает параметры

- analyze (id youtube каналов через запятую)
- statistics (id канала для получения статистики)
- top_n (получить топ n каналов по соотношению likes/dislikes);

Пример:

php index.php analyze UCMcDsSeqS531-HKz6GiJgtA,UC2QJf0YXCH57FR588wQIaSg

php index.php statistics UCMcDsSeqS531-HKz6GiJgtA

php index.php ton_n 3
17 changes: 17 additions & 0 deletions app/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
YOUTUBE_API_KEY=API_KEY
YOUTUBE_CLIENT_ID=CLIENT_ID
YOUTUBE_CLIENT_SECRET=CLIENT_SECRET

#no_sql can be => ElasticSearch, MongoDB
NO_SQL_DB='ElasticSearch'

ELASTIC_SEARCH_HOST=elastic-search
ELASTIC_SEARCH_PORT=9200

VIDEOPLATFORM=youtube

MONGODB_HOST=mongo-db
MONGODB_PORT=27017
MONGODB_USERNAME=root
MONGODB_PASSWORD=root
MONGODB_DATABASE=otus
6 changes: 6 additions & 0 deletions app/bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

require_once '../vendor/autoload.php';

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();
25 changes: 25 additions & 0 deletions app/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "rsm/app",
"description": "hw-otus",
"type": "project",
"authors": [
{
"name": "yessaliyev",
"email": "40271311+yessaliyev@users.noreply.github.com"
}
],
"minimum-stability": "dev",
"require": {
"google/apiclient": "^2.0",
"vlucas/phpdotenv": "^5.2@dev",
"guzzlehttp/guzzle": "^7.1@dev",
"elasticsearch/elasticsearch": "dev-master",
"mongodb/mongodb": "1.9.x-dev",
"monolog/monolog": "2.x-dev"
},
"autoload": {
"psr-4": {
"VideoPlatform\\": "src/hw"
}
}
}
Loading