To make an API to fetch latest videos sorted in reverse chronological order of their publishing date-time from YouTube for a given tag/search query in a paginated response.
- Server calls the YouTube API continuously in background (async) with an interval of 10 seconds for fetching the latest Cricket videos and stores the data of videos (specifically these fields - Video title, description, publishing datetime, thumbnails URLs in a database with proper indexes.
- A GET API which returns the stored video data in a paginated response sorted in descending order of published datetime.
- A basic search API to search the stored videos using their title and description.
- Dockerized the project.
- Project is scalable and optimised.
- Added support for supplying multiple API keys so that if quota is exhausted on one, it automatically uses the next available key.
- Made a dashboard to view the stored videos with filters and sorting options.
docker-compose up -d --build
- a. Visit
http://localhost:1337/videos
in the browser. - b. Click on the
Filters
button (in the top right) for search and sorting options. docker ps
for running containers.docker-compose exec web python manage.py shell
for Django shell access.docker-compose logs -f 'celery'
for checking Celery logs.docker-compose exec db psql --username=hello_django --dbname=hello_django_dev
for checking Postgres DB.
.env.dev
is a environmental variable file that would NOT be stored in a GitHub repository, given a production setup/environment.