Find evil content in YouTube comments
# in Linux replace 'set' with 'export'
set YOUTUBE_API_KEY=<your_key>
docker-compose up -d --buildBefore docker-compose up, you can set more optional settings:
# in Linux replace 'set' with 'export'
set ASYNC_WORKERS=<number>
set MONGODB_FLASK_USERNAME=<name>
set MONGODB_FLASK_PASSWORD=<password>
set MONGODB_ADMIN_USERNAME=<name>
set MONGODB_ADMIN_PASSWORD=<password>You can use tools like Postman to send HTTP requests.
Scan all comments of a YouTube video:
http://127.0.0.1:5001/youtube/videos/<video_id>/comments [PUT]
Or with max parameter:
http://127.0.0.1:5001/youtube/videos/<video_id>/comments?max=<max> [PUT]
Now you can connect to the database and view the new data in flaskdb db.
The connection string is:
mongodb://mongodbadmin:temp_admin_password@localhost:27019
Change
mongodbadminandtemp_admin_passwordif you used customMONGODB_ADMIN_USERNAMEandMONGODB_ADMIN_PASSWORD.
To delete the users and data in MongoDB, run:
docker-compose down
docker volume rm findevil_mongodbdata
Now you can start again with fresh db and run docker-compose up as described above.
- Python 3.9
- Docker
cd mongo
docker build -t mongo-findevil:latest .
docker run --name mongodb-dev -p 27018:27017 --env-file .env.dev -d mongo-findevil:latestUse port 27018 to connect to the dev database:
mongodb://mongodbadmin:temp_admin_password@localhost:27018
Windows:
cd flask
copy .env.dev .env
# edit your .env file...
py -m venv env
.\env\Scripts\activate
pip install -r requirements-dev.txt
flask runLinux:
cd flask
cp .env.dev .env
# edit your .env file...
python3 -m venv env
source env/bin/activate
pip install -r requirements-dev.txt
flask runUse port 5000 to send requests to the dev server:
http://127.0.0.1:5000/youtube/videos/<video_id>/comments [PUT]
To debug Flask, instead of flask run use the debugger in VSCode.
- Find evil content in comments.
- Performance: Find links in comments by using another service.
- Performance: Consider using Aiogoogle for better async.
- Performance: Add load balancing to handle multiple requests.