OpenTube
Access YouTube Public Data without YouTubeAPI
Table of Contents
Installing
Python 3.6 or higher is required
# Linux/macOS
python3 -m pip install -U opentube
# Windows
python -m pip install -U opentube
Build from source
pip install git+https://github.com/jnsougata/opentube
Quick Start
import opentube
channel = opentube.Channel('@GYROOO')
print(channel.metadata)
video = opentube.Video('WVDT4lSozHk')
print(video.metadata)
playlist = opentube.Playlist('PL-xXQjd8X_Q-xXQjd8X_Q-xXQjd8X_Q-')
print(playlist.metadata)
search = opentube.Search.video('YouTube Rewind 2018')
print(search.metadata)
search = opentube.Search.channel('PewDiePie')
print(search.metadata)
search = opentube.Search.playlist('Unlock Your Third Eye')
print(search.metadata)
Usage
Channel
| Property | Return Type | Description |
|---|---|---|
live |
bool |
Returns True if the channel is live |
streaming_now |
str |
Returns the video id of the ongoing livestream |
current_streams |
List[str] |
Returns a list of ids of ongoing livestreams |
old_streams |
List[str] |
Returns a list of ids of old livestreams |
video_count |
int |
Returns total number of videos uploaded by the channel |
upcoming |
Video |
Returns a video object of the upcoming video |
upcomings |
List[str] |
Returns a list of ids of upcoming videos |
playlists |
List[str] |
Returns a list of playlist ids |
metadata |
Dict[str, Any] |
Returns the metadata of the channel in dict format |
last_uploaded |
Video |
Most recently uploaded video of the channel |
last_streamed |
Video |
Most recently completed livestream of the channel |
| Method | Return Types | Description |
|---|---|---|
uploads(limit: int | None) |
List[str] |
Returns a list of video ids of the uploaded videos |
Video
| Properties | Return Types | Description |
|---|---|---|
metadata |
Dict[str, Any] |
Returns the metadata of the video in dict format |
Playlist
| Properties | Return Types | Description |
|---|---|---|
metadata |
Dict[str, Any] |
Returns the metadata of the playlist in dict format |
Search
| Method | Return Type | Description |
|---|---|---|
channel(name: str) |
Channel |
Finds a channel with the given keywords |
video(name: str) |
Video |
Finds a video with the given keywords |
playlist(name: str) |
Playlist |
Finds a playlist with the given keywords |
channels(name: str, limit: int | None) |
List[str] |
Finds all channels that matches the given keywords |
videos(name: str, limit: int | None) |
List[str] |
Finds all videos that matches the given keywords |
playlists(name: str, limit: int | None) |
List[str] |
Finds all playlists that matches the given keywords |
Possible Exceptions
| Class | Description |
|---|---|
InvalidURL |
Raised when then url is not a valid YouTube endpoint |
TooManyRequests |
Raised when client IP receives soft ban from YouTube |
RequestError |
Raised for any type of request error not handled by the library |
Metadata
Release files for opentube 1.7.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentube-1.7.4.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentube-1.7.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.0 kB
Release files / opentube-1.7.4.tar.gz
| Download URL | opentube-1.7.4.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1358c13bea98bcca6ea2a7b3170047e7c6909693842f55138dd9e281eeb7ec6
|
|
BLAKE2b-256 checksum How to use checksums |
04639258016358c72a857df4341a87b4e85836060abbce9d3aa405b00363d24f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / opentube-1.7.4-py3-none-any.whl
| Download URL | opentube-1.7.4-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb17b043d2ae15f41d5261987ef92f96a630befc9f2ec72ddf195d5743e2badc
|
|
BLAKE2b-256 checksum How to use checksums |
dc12770a83de6ce39852215fde79afcf94e23590f38a0cac65e5825f767565d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|