Skip to content

Instantly share code, notes, and snippets.

@chris-lovejoy
Last active March 8, 2021 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-lovejoy/153f0e3ac0f0e5c1309201d9115eef53 to your computer and use it in GitHub Desktop.
Save chris-lovejoy/153f0e3ac0f0e5c1309201d9115eef53 to your computer and use it in GitHub Desktop.
Initial search
from apiclient.discovery import build
api_key='AIzaKyAq3L9BiVO0PXrGBhhY0cNN9fkPmm_BsPg' # (not a real API key)
youtube_api = build('youtube','v3', developerKey=api_key)
# Search videos
video_search_results = youtube_api.search().list(q='productivity', part='snippet', type='video',
order='viewCount', maxResults=50).execute()
# Search channels
channel_search_results = youtube_api.channels().list(id=channel_id, part='statistics').execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment