X Tutup
The Wayback Machine - https://web.archive.org/web/20230320081049/https://github.com/srcecde/python-youtube-api
Skip to content

srcecde/python-youtube-api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Video example: https://youtu.be/ooZ98n-ZDUA

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
X Tutup