Skip to content

Overview

YouTube DL Scraper is a Python library for scraping YouTube video/audio streams and metadata. It's lightweight, easy to use, and perfect for integrating YouTube data into your projects.

Warning

This is the alpha version and the project is still in the testing phase.


Features

  • Fetch video metadata such as title, description, and available streams.
  • Filter video/audio streams by resolution, bitrate, or format.
  • Download video/audio streams effortlessly.
  • Modular and extensible for advanced use cases.

Installation

Install via pip recommended

YouTube DL Scraper is published as a Python package and can be installed with pip, ideally by using a virtual environment1. Open up a terminal and install YouTube DL Scraper with:

pip install youtube-dl-scraper

Example Usage

Fetch title and download YouTube video:

example.py
from youtube_dl_scraper import YouTube # (1)!

youtube = YouTube()

# Scrape video data
video = youtube.scrape_video("https://youtu.be/sF9xYtouZjY?si=z6ZWk4raQeHgQDz")

print(video.title) # Print the video title (2)
# Download video
print(video.streams.get_highest_resolution().download()) # (3)!
  1. Importing scraper from package
  2. Output: 'Driving The New Fastest Car Ever Made!'
  3. Output (file path): 'driving-the-new-fastest-car-ever-made-720p-30fps.mp4'

  1. A virtual environment in programming (specifically in Python) is an isolated workspace that allows you to manage dependencies, libraries, and tools for a particular project without affecting the global system environment.