Skip to content

A basic Python YouTube v3 API to fetch data from YouTube using public API-Key without OAuth

License

Notifications You must be signed in to change notification settings

srcecde/python-youtube-api

Repository files navigation

Python YouTube API

A basic Python YouTube v3 API to fetch data from YouTube using public API-Key without OAuth.

It can fetch video comments for a given video URL, keyword based search (returns videos, playlist, channel) and return videos data for a given channelId. It store the data into output directory in CSV files.

You are required to get the API key from Google API console in order to use this script

Install Dependencies

  • pip3 install -r requirements.txt

How to use

  • Pass --c after file name for fetching comments from videos
  • Pass --s after file name for fetching results based on search keyword
  • Pass --sc after file name for fetching videos based on YouTube ChannelId

It is mandatory to pass any of the above argument after file name

Video Comments

  • --max argument for defining the maximum result to return (default=10)
  • --videourl argument for defining the youtube URL Mandatory
  • --key argument for defining API key Mandatory
Example: python3 main.py --c --max 10 --videourl https://www.youtube.com/watch?v=y_j-r8x1FtI --key AAAAAAA

Search by Keyword

  • --max argument for defining the maximum result to return (default=10)
  • --search argument for giving the keyword
  • --r argument for defining region (Country) For ex. --r=IN (Argument should be a country code)
  • --key argument for defining your developer API key Mandatory
Example: python3 main.py --s --search "srce cde" --max 10 --key AAAAAAA

Search Videos by YouTube ChannelId

  • --max argument for defining the maximum result to return (default=10)
  • --channelid argument for defining channel id Mandatory
  • --key argument for defining your developer API key Mandatory
Example: python3 main.py --sc --channelid UCwDlyuX3Fkg5WNBufLnH6dw --max 10 --key AAAAAAA

YouTube API v3

About

A basic Python YouTube v3 API to fetch data from YouTube using public API-Key without OAuth

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published