Skip to main content

Search on youtube avoiding the use their heavily rate-limited API. Fork of original youtube-search by joetats

Project description

Generic badge Generic badge

youtube_search-fork

This fork adds the ability to search for channels, latest content of a channel, channel information, channel vidoes, and adds videos published date and channelId. It works scrapping the Youtube pages.

  • Search on youtube avoiding the use their heavily rate-limited API.
  • No need for Google account.
  • No limits.
  • Reasonably fast.

Installation

pip install youtube-search-fork

Example Usage

For a basic search (and all of the current functionality), you can use the search tool as follows:

  • Get Youtube channel videos and channel info and parse it to JSON.
from youtube_search import YoutubeSearch

videos = YoutubeSearch('search terms', max_results=10).videos_to_json()
channels = YoutubeSearch('search terms', max_results=10).channels_to_json()

This will get all the videos from the search query into videos and all the found channels into channels and parse it in a JSON format.

  • Get Youtube search videos and channels and parse it to a dict.
from youtube_search import YoutubeSearch

videos = YoutubeSearch('search terms', max_results=10).videos_to_dict()
channels = YoutubeSearch('search terms', max_results=10).channels_to_dict()

This will get all the videos from the search query into videos and all the found channels into channels and parse it in a Python dictionary.

  • Get a specific channel info and videos:
from youtube_search import YoutubeSearch
data = YoutubeSearch.channelInfo(channel_id)


channelInfo = data[0]
channelVideoList = data[1]

This will get all the videos and their data from the specified channel (channelID needed) into channelVideoList and the channel data (suscribers, username, etc) into channelVideoList.

  • You can request only the channel info:
from youtube_search import YoutubeSearch

# The second (and optional) parameter is `includeVideos`. By default is se to True.
channelOnlyData = YoutubeSearch.channelInfo(channel_id, False)
channelInfo = data[0]

Same as before, but just the channel data.

Formats

  • Channel info format: {'id': 'UCjr2bPAyPV.....8Q', 'name': 'Channel Name', 'avatar': 'https://yt3.ggpht.com/a/AATXAJzuPoT_2M54dus-P2qXgnbY0MPxbkzvwv3muxQn=s176-c-k-c0x00ffffff-no-rj', 'subCount': '24K'}

  • Video list format: [{'videoTitle': 'Video title goes here', 'id': 'video_id_here', 'channelName': 'Channel Name', 'timeStamp': '17 hours ago', 'views': '13,661 views', 'videoThumb': 'https://i.ytimg.com/vi/3eC4Hp4MNBA/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4....5o_2mazZd40g_xc_3917M5w', 'channelUrl': '/channel/UCjr2bPA.......gT3W8Q'}, {...}, {...}, ...]

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

youtube-search-fork-1.2.5.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file youtube-search-fork-1.2.5.tar.gz.

File metadata

  • Download URL: youtube-search-fork-1.2.5.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for youtube-search-fork-1.2.5.tar.gz
Algorithm Hash digest
SHA256 224ef75f9b660679fb48f924c275be86bf1c3f338dbbda236ae00f2669b787e9
MD5 6615b6e41dd4287f60e03cac3565ee05
BLAKE2b-256 bff18dbed88bc1df42c66c4e6b145a2c7aef1b6e1865d6c3dbec5e99248d6b0b

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