YouTube Downloader

This function downloads YouTube content at scale with support for video, audio, subtitles, and metadata extraction.

Key Features

  • Multiple Content Types: Download videos, audio-only files, subtitles, or metadata.
  • Resolution Options: Support for multiple resolutions from 144p to 1080p.
  • Video Segments: Extract specific portions of videos using the start_time and end_time parameters.
  • Format Flexibility:
    • Video formats: MP4, WebM
    • Audio formats: MP3, WAV, M4A
  • Subtitle Support: Download subtitles in multiple languages using ISO-639-1 codes.
  • Rich Metadata: Access video details including title, thumbnail, description, tags, and duration.
  • Customizable Downloads: Mix and match features like combining video with metadata or subtitles.

Pricing

Download TypePrice
Video/Audio$0.10 per GB
Metadata$0.001 per video
Subtitles$0.001 per language

Example Cost Calculation

If you download a 1080p 30minutes video with metadata and subtitles in two languages:

  • Video (1GB) = $0.10
  • Metadata = $0.001
  • Subtitles = $0.001 *2 = $0.002
  • Total = $0.103

Notes

Response Format and Structure

Combined Output Order

When combining multiple output types (e.g., video with metadata and subtitles), the function yields results in the following sequence:

  1. Metadata dictionary (if requested)
  2. Media file (video or audio)
  3. Subtitles dictionary (if requested)

Video Downloads

  • MP4: H.264 codec with audio (default)
    • Resolution options: 144p to 1080p
    • Returns: sieve.File with .mp4 extension
  • WebM: VP9 codec with audio
    • Resolution options: 144p to 1080p
    • Returns: sieve.File with .webm extension

Audio Downloads

  • MP3: Standard audio format (default)
    • Returns: sieve.File with .mp3 extension
  • WAV: Uncompressed audio format
    • Returns: sieve.File with .wav extension
  • M4A: AAC audio format
    • Returns: sieve.File with .m4a extension

Metadata Downloads

  • Returns: Dictionary with requested fields
    {
      "title": "Video Title",
      "description": "Video Description",
      "tags": ["tag1", "tag2", ...],
      "duration": "HH:MM:SS",
      "thumbnail": {
        "default": {"url": "...", "width": 120, "height": 90},
        "medium": {"url": "...", "width": 320, "height": 180},
        "high": {"url": "...", "width": 480, "height": 360}
      }   
    }
    

Subtitle Downloads

  • Format: WebVTT (.vtt)
  • Returns: Dictionary of sieve.File objects
    {
      "en": sieve.File("path/to/subtitles.en.vtt"),
      "es": sieve.File("path/to/subtitles.es.vtt")
    }
    

Combined Downloads: Video, Subtitles, and Metadata

To download a video along with its subtitles and metadata in a single request:

  1. Set download_type to "video"
  2. Enable additional content by setting:
    • include_subtitles: True
    • include_metadata: True
  3. Customize your request with:
    • subtitle_languages: List of language codes (e.g., ["en", "es"])
    • metadata_fields: List of desired metadata fields (e.g., ["title", "description"])

The function will return all requested components in a single response.

Supported Metadata Fields

The following metadata fields are supported:

  • title: The title of the video
  • description: The full description of the video
  • tags: List of tags associated with the video
  • duration: Video duration in HH:MM:SS format
  • thumbnail: Dictionary containing thumbnail URLs and dimensions at different resolutions

Extracting Video Clips

You can extract specific segments from a video or audio by using the time parameters:

  • start_time: Beginning of the clip (in seconds)
  • end_time: End of the clip (in seconds)

This will return a clip from the original video or audio file containing only the content between the specified timestamps.