scrapetube Documentation

repository·master·Indexed 19 days ago

https://github.com/dermasmid/scrapetube

A Python module for scraping YouTube data, including channel videos, playlist videos, and search results, without requiring Selenium or the official YouTube API. It provides core functions such as get_channel, get_playlist, and get_search to retrieve iterables of video dictionaries.

Tokens
613
Snippets
4
Records
6
Agent score
18%

What's inside scrapetube

  1. Overview of Scrapetube capabilities

    master

    Scrapetube is a Python module designed to scrape YouTube data without requiring the official YouTube API or Selenium. It provides high-level functions to retrieve video information through three primary workflows:

    • Channel Scraping: Retrieve all videos associated with a specific YouTube channel.
    • Playlist Scraping: Retrieve all videos within a specific YouTube playlist.
    • YouTube Search: Perform searches on YouTube to find relevant videos.
  2. Get all videos from a YouTube channel

    master

    Use scrapetube.get_channel(channel_id) to retrieve all videos associated with a specific YouTube channel ID. The returned object is an iterable of video dictionaries, where each dictionary contains a 'videoId' key.

    import scrapetube
    
    videos = scrapetube.get_channel("UCCezIgC97PvUuR4_gbFUs5g")
    
    for video in videos:
        print(video['videoId'])
  3. Search YouTube using scrapetube

    master

    Use scrapetube.get_search(query) to perform a search on YouTube. The returned object is an iterable of video dictionaries, where each dictionary contains a 'videoId' key.

    import scrapetube
    
    videos = scrapetube.get_search("python")
    
    for video in videos:
        print(video['videoId'])
  4. Get all videos from a YouTube playlist

    master

    Use scrapetube.get_playlist(playlist_id) to retrieve all videos from a specific YouTube playlist ID. The returned object is an iterable of video dictionaries, where each dictionary contains a 'videoId' key.

    import scrapetube
    
    videos = scrapetube.get_playlist("PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU")
    
    for video in videos:
        print(video['videoId'])
  5. Use scrapetube functions for scraping

    master

    The core functionality of the scrapetube module is exposed through three main functions. You can use these to fetch video data based on different YouTube identifiers:

    • get_channel: Fetches videos from a channel.
    • get_playlist: Fetches videos from a playlist.
    • get_search: Performs a search query on YouTube.