Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ankitjaadoo/fetch_youtube_videos_api
This project creates 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.
https://github.com/ankitjaadoo/fetch_youtube_videos_api
Last synced: 17 days ago
JSON representation
This project creates 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.
- Host: GitHub
- URL: https://github.com/ankitjaadoo/fetch_youtube_videos_api
- Owner: ankitjaadoo
- License: apache-2.0
- Created: 2022-07-13T17:42:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-14T04:43:10.000Z (over 2 years ago)
- Last Synced: 2024-11-05T12:12:41.744Z (2 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Project Goal ✨
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.
## About it :scroll:
* choose any search query, for example: official, cricket, football and GET API will returns the stored video data in a paginated response sorted in descending order of published datetime.
* Added support for supplying multiple API keys so that if quota is exhausted on one, it automatically uses the next available key.## Tech Stack :memo:
* Django
* Django Rest Framework
* YouTube data v3 API## Setting Up 🔨
Setup Steps- Clone the Repository
```
$ git clone https://github.com/ankitjaadoo/Fetch_Youtube_Videos_API
```
- Go the the folder
```
$ cd fetch_youtube_video_API
```
- Setup Virtual environment
```
$ python3 -m venv env
```
- Activate the virtual environment
```
$ source env/Scripts/activate - for Windows
$ source env/bin/activate - for Mac
```
- Install dependencies using
```
$ pip install -r requirements.txt
```
- Modify settings.py File - Remove the existing keys and add your own YouTube Data API keys in the form [key1, key2, ...]:
```
$ API_KEYS = ['Google_API_Key_1', 'Google_API_Key_2','Google_API_Key_3',]
```
- Make migrations using
```
$ python manage.py makemigrations
```
- Migrate Database
```
$ python manage.py migrate
```
- Create a superuser
```
$ python manage.py createsuperuser
```
- Run server using
```
$ python manage.py runserver
```
## Usage :label:
Run the manage.py file:
```python
python manage.py runserver
```
## Reference:YouTube data v3 API: https://developers.google.com/youtube/v3/getting-started
Search API reference: https://developers.google.com/youtube/v3/docs/search/list
To fetch the latest videos you need to specify these: type=video, order=date, publishedAfter=
Without publishedAfter, it will give you cached results which will be too old## Directory Structure
API_Youtube
.
├── Contains
| ├── Images # Contain screenshots of the project and other images
│ ├── API # The main Django app/api containing the models, views, serializers etc
│ ├── API_Youtube # All the settings and url routes settings of the REST API
| ├── db.sqlite3 # SQLite database housing the data of the videos fetched
│ └── manage.py # Python code used for starting the app by establishing DRF server
| └── requirements.txt # Requirements file
|______________________
[![forthebadge made-with-python](http://ForTheBadge.com/images/badges/made-with-python.svg)](https://github.com/ankitjaadoo/Fetch_Youtube_Videos_API)