API to fetch latest videos of football category from YouTube.
- Django
- YouTube data v3 API
- Html, Css and Js
Step 1: Install the virtualenv package by runninng
pip install virtualenv
Step 2: Create the virtualenv by runninng
virtualenv -p python3 videos_venv
Step 3: Install all packages
pip install -r /path/to/requirements.txt
Step 4: Activate the virtualenv by runninng
source videos_venv/bin/activate
Step 5: Deactivate the virtualenv by simply runninng
deactivate
Step 6: Keep updating the requirements.txt if any new packages are installed by running
pip freeze > requirements.txt
To resume development post new pulls, always run pip install -r /path/to/requirements.txt to install the latest requirements.
Step 7: Run Cron Job. for more details
python manage.py crontab add
Step 8: Run Django Server
python manage.py runserver
- Provide Api to get latest video of predefined query.
- Change Api Key Automatic if current key exhausted.
- Simple Home page to see latest videos.
- Video Output
-
Get videos
Method: Get
url
videos/<int:page>/<int:per_page_items>
Params
page: page number to get per_page_items: number of videos per page
Response
{ "page": { "current": "Number-current page number", "has_next": "Boolean-if we have next page", "has_previous": "Boolean-if we have previous page" }, "data": [ { "id": "Id", "title": "String-Title of video", "description": "String -Description of video", "video_id": "String", "thumbnail": "URL", "publish_time": "Time", "channel_title": "String- Channel title" } ] }