Git Product home page Git Product logo

fetch_youtube_videos_api's Introduction

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 ๐Ÿ“œ

  • 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 ๐Ÿ“

  • 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 ๐Ÿท๏ธ

Run the manage.py file:

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=<SOME_DATE_TIME>
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

fetch_youtube_videos_api's People

Contributors

ankitjaadoo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.