Skip to main content

Access YouTube Public Data without YouTubeAPI

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentube-1.7.3.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opentube-1.7.3-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file opentube-1.7.3.tar.gz.

File metadata

  • Download URL: opentube-1.7.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for opentube-1.7.3.tar.gz
Algorithm Hash digest
SHA256 cbeaa12dfc53cb473c1e1a0ff6cfd8412bfdc121e72a2226e7730b11201ef100
MD5 24788d471f0c4eccd6f640a2159c93fa
BLAKE2b-256 e2efc817a7f3e1828f5c1a23ff4f894db3197a45a45c23a49428cc7f2f9bda75

See more details on using hashes here.

File details

Details for the file opentube-1.7.3-py3-none-any.whl.

File metadata

  • Download URL: opentube-1.7.3-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for opentube-1.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc3e063f716dd8d247fa3811f1b3ad0c0d434977a4d3cfcb009ffea6cb68b733
MD5 d3c557205daf44c4e45baa419db255cf
BLAKE2b-256 b84a6d4d872c813f92dd23ebad28e031ea1ec65ead4487149034852a286f7357

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page