Last updated:
0 purchases
oryksyoutube 0.14.1
youtube
Overview
A python library that wraps around the YouTube V3 API. You can use it find and manage YouTube resources including Videos, Playlists, Channels and Comments.
The library is modelled after Google's own documentation.
Requirements
Python 3.10+
Works on Linux, Windows, macOS, BSD
Installation
pip install oryks-youtube
Get started
To get started, you need a verified Google Account and Google API keys with the correct permissions.
How to Get A Google API Key
Follow the instructions in this short article to get an API key.
To get a particular video using the videos' id:
Create an instance of the YouTube API passing in the path to the downloaded client secret file:
from youtube import YouTube
client_secrets_file = '/home/lyle/Downloads/secrets.json'
youtube = YouTube(client_secrets_file)
youtube.authenticate()
Use the video id to find the video:
video = youtube.find_video_by_id('rfscVS0vtbw')
To find many videos using their id's:
ids = ['rfscVS0vtbw', 'TFa38ONq5PY']
videos = youtube.find_videos(ids)
To find the most popular videos in a given region e.g Kenya, pass in the region code:
popular_kenyan_videos = youtube.find_most_popular_video_by_region('ke')
To search for videos (this returns an iterator):
from youtube.schemas import (
SearchFilter, SearchOptionalParameters, SearchPart, YouTubeResponse, YouTubeRequest
)
from typing import Iterator
from youtube.models import Video
query: str = 'Python programming videos'
max_results: int = 10
part: SearchPart = SearchPart()
optional_parameters: SearchOptionalParameters = SearchOptionalParameters(
q=query,
maxResults=max_results,
type=['video', 'playlist', 'channel']
)
search_request: YouTubeRequest = YouTubeRequest(
part=part,
optional_parameters=optional_parameters
)
video_iterator: Iterator = youtube.get_search_iterator(search_request)
videos: list[Video] = next(video_iterator)
Documentation and Tutorials
To learn more about the library including the documentation and tutorials, check out the libraries' documentation.
How to Contribute
To contribute, chack out the contribution guideline.
License
The API uses an MIT License
Developer
Lyle Okoth – @lylethedesigner on twitter
lyle okoth on medium
My email is [email protected]
Here is my GitHub Profile
You can also find me on Linkedin
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.