Skip to content

Very simple interface for Youtube API v3 to search videos and fetch public video data.

License

Notifications You must be signed in to change notification settings

MrKrautee/simple-youtube-video-finder

Repository files navigation

simple-youtube-video-finder

Very simple interface for Youtube API v3 to fetch public video data. No need for OAuth2.0 or many dependencies (needs only requests).

Having some auth and quota issues with the official python api googleapis/google-api-python-client and just for fun, I ended up coding this easy api for my simple needs. used in MrKrautee/video-gatherer.

Features

  • fetches public youtube video data
  • implements following endpoints:
  • option to cache requests for development ('save quota')
  • option to fetch all search results at once (no pagination)
  • option to include detailed video informations, 'contentDetails' (uses more quota)

Usage

from video_finder import video_finder

finder = video_finder.YoutubeFinder("my-api-key")
videos = finder.search_videos(search_query="summon python", content_details=True)
for v in videos:
    print(f"{v.title} - {v.duration}")

Read the code for more details:

YoutubeFinder will return those types in a list:

YoutubeAPI will return the raw response from the youtube rest api.

As I mentioned, read the sources for further information: video_finder/video_finder.py

Supported Search Params

for all searches:

supported ? param name
x part(required)
x channelId
x channelType
x maxResults
x order
x pageToken
x published_after
x published_befor
x q
x type
regionCode
x relevanceLanguage
safeSearch
location
locationRadius

only for video searches:

supported ? param name
x eventType
x videoCaption
x videoDuration
x videoEmbeddable
videoLicense
videoSyndicated
videoType
x videoDefinition
videoDimension
x relatedToVideoId
videoCategoryId

Development

Run Tests

$ export YOUTUBE_API_KEY=Your-Api-Key-abcdefg
$ python -m pytest tests --verbose

Resources

About

Very simple interface for Youtube API v3 to search videos and fetch public video data.

Topics

Resources

License

Stars

Watchers

Forks

Languages