HANDLERS.md

Platform Handlers Documentation

This document describes the platform-specific handlers in the Ultimate Media Downloader. Each handler is designed to work with a specific streaming or content platform, extracting metadata and facilitating downloads.


Overview

Handlers are specialized modules that know how to work with specific platforms. While yt-dlp can download from many sites directly, some platforms require special handling for:

  • Metadata extraction and embedding
  • Authentication or cookie management
  • Content discovery (playlists, albums, channels)
  • Quality selection
  • Anti-bot bypass techniques

Handler Location

All handlers are located in the handlers/ directory:

handlers/
    __init__.py
    spotify_handler.py
    apple_music_handler.py
    jiosaavn_handler.py
    gaana_handler.py
    tumblr_handler.py
    linkedin_handler.py
    pinterest_handler.py
    reddit_handler.py
    instagram_handler.py
    pornhub_handler.py
    xnxx_handler.py
    xhamster_handler.py
    hianime_handler.py
    tiktok_handler.py
    eporner_handler.py
    hqporner_handler.py
    beeg_handler.py
    four_k_wallpapers_handler.py

Handler Architecture

Every handler follows a consistent pattern that makes them predictable and easy to understand.

Common Structure

Loading diagram...

Common Methods

Every handler implements these core methods:

MethodPurpose
__init__(downloader)Initialize with reference to main downloader
search_and_download(url)Main entry point for processing URLs
_print(message)Print messages using Rich formatting if available

Spotify Handler

File: handlers/spotify_handler.py

The Spotify Handler enables downloading music from Spotify by searching for equivalent content on YouTube.

How It Works

Loading diagram...

Supported Content Types

Content TypeURL PatternExample
Track/track/https://open.spotify.com/track/xxx
Album/album/https://open.spotify.com/album/xxx
Playlist/playlist/https://open.spotify.com/playlist/xxx
Artist/artist/https://open.spotify.com/artist/xxx

Configuration

The handler can use the official Spotify API for better metadata extraction:

# Set environment variables for API access
export SPOTIFY_CLIENT_ID="your_client_id"
export SPOTIFY_CLIENT_SECRET="your_client_secret"

Without API credentials, the handler scrapes the Spotify webpage for basic information.

Key Features

  • Automatic album and playlist download with progress tracking
  • High-quality metadata embedding (title, artist, album, year, cover art)
  • Interactive quality selection
  • Batch downloading support

Apple Music Handler

File: handlers/apple_music_handler.py

The Apple Music Handler works similarly to Spotify, searching YouTube for equivalent content.

Processing Flow

Loading diagram...

Supported Content Types

Content TypeURL Pattern
Songmusic.apple.com/.../song/...
Albummusic.apple.com/.../album/...
Playlistmusic.apple.com/.../playlist/...
Artistmusic.apple.com/.../artist/...

Metadata Extraction

The handler uses cloudscraper to bypass protection and BeautifulSoup to parse:

  • Song title
  • Artist name
  • Album name
  • Album artwork URL
  • Track duration
  • Release date

Key Features

  • Cloudflare bypass using cloudscraper
  • Rich metadata extraction from Apple Music pages
  • Album and playlist batch downloading
  • Cover art embedding

Gaana Handler

File: handlers/gaana_handler.py

The Gaana Handler downloads Indian music from Gaana platform with comprehensive metadata support and flexible song selection.

Processing Flow

Loading diagram...

Supported Content Types

Content TypeURL Pattern
Songgaana.com/song/...
Albumgaana.com/album/...
Playlistgaana.com/playlist/...
Artistgaana.com/artist/...

Web Scraping Integration

The handler uses BeautifulSoup for metadata extraction:

Data SourcePurpose
Meta tags (og:title, og:image)Basic metadata
JSON-LD structured dataDetailed track/album information
Page linksSong discovery for albums/playlists

Interactive Song Selection

For albums, playlists, and artists, the handler provides:

  • Display: Numbered list of all songs with artist names
  • Selection Options:
    • Press Enter or type 'all' → Download all tracks
    • Type specific numbers: 1,3,5 → Download songs 1, 3, and 5
    • Type ranges: 1-10 → Download songs 1 through 10
    • Combine: 1-5,8,10 → Download multiple ranges/songs
    • Type 'cancel' → Abort download

Metadata Extraction

The handler extracts comprehensive metadata:

  • Song title (with HTML entity decoding)
  • Artist name(s)
  • Album name
  • Release year
  • Album artwork URL
  • Song duration

YouTube Search with Scoring

Uses intelligent YouTube search with scoring algorithm:

FactorWeight
Title match100 points
Artist match50 points
Official content30 points
Audio/lyric video20 points
View countUp to 30 points
Like ratioUp to 15 points
Unwanted keywords-50 points

Example Usage

# Download a single track
umd https://gaana.com/song/financer-5

# Download an album (with song selection)
umd https://gaana.com/album/financer

# Download a playlist (with song selection)
umd https://gaana.com/playlist/gaana-dj-haryanvi-top-50

# Download artist's songs (with song selection)
umd https://gaana.com/artist/bintu-pabra

Format Support

Supports multiple audio formats with quality selection:

  • MP3: Best quality (320kbps)
  • M4A: High quality (256kbps AAC)
  • FLAC: Lossless (larger files)
  • Auto: Best available quality

Technical Implementation

The handler implements several advanced features:

  1. HTML Entity Decoding: Converts ", & to proper characters
  2. Smart Song Selection: Parse user input like 1,3-5,7 for flexible downloads
  3. Format Preservation: Selected format/quality passed to all track downloads
  4. Error Recovery: Continues downloading remaining songs if one fails

Key Features

  • ✅ Single tracks with full metadata
  • ✅ Complete albums with song selection
  • ✅ Full playlists with song selection
  • ✅ Artist pages with song selection
  • ✅ Album artwork embedding (MP3, M4A, FLAC)
  • ✅ Flexible format selection (MP3/M4A/FLAC)
  • ✅ Interactive song selection UI
  • ✅ YouTube search with intelligent scoring

JioSaavn Handler

File: handlers/jiosaavn_handler.py

The JioSaavn Handler downloads Indian music from JioSaavn platform with comprehensive metadata support.

Processing Flow

Loading diagram...

Supported Content Types

Content TypeURL Pattern
Songjiosaavn.com/song/...
Albumjiosaavn.com/album/...
Playlistjiosaavn.com/featured/... or jiosaavn.com/s/playlist/...
Artistjiosaavn.com/artist/...

JioSaavn API Integration

The handler uses JioSaavn's unofficial API endpoints for metadata:

EndpointPurpose
autocomplete.getSearch functionality
song.getDetailsTrack metadata and streaming URLs
content.getAlbumDetailsAlbum information and track list
playlist.getDetailsPlaylist contents
lyrics.getLyricsSong lyrics in multiple languages

Metadata Extraction

The handler extracts comprehensive metadata:

  • Song title (with HTML entity decoding)
  • Artist name(s) (primary and featuring artists)
  • Album name
  • Release year
  • Song duration
  • High-quality cover art (500x500)
  • Lyrics (if available)
  • Album artist
  • Copyright information

Key Features

  • Official API Integration: Uses JioSaavn's API for reliable metadata
  • High-Quality Metadata: Extracts detailed song information including multiple artists
  • Lyrics Support: Downloads and embeds lyrics when available
  • Cover Art: Embeds high-resolution album artwork
  • HTML Entity Decoding: Properly handles special characters in titles
  • Batch Processing: Supports album and playlist downloads with progress tracking
  • Fallback API: Uses alternative API endpoints if primary fails
  • Concurrent Downloads: Multi-threaded downloading for playlists
  • YouTube Search: Falls back to YouTube for actual audio streaming

Example Usage

# Download a single track
umd https://www.jiosaavn.com/song/kesariya/...

# Download an entire album
umd https://www.jiosaavn.com/album/brahmastra/...

# Download a playlist
umd https://www.jiosaavn.com/featured/...

# Download artist's top songs
umd https://www.jiosaavn.com/artist/arijit-singh/...

Technical Implementation

The handler implements several advanced features:

  1. HTML Entity Decoding: Converts ", & to proper characters
  2. Multi-Artist Support: Handles songs with multiple featured artists
  3. Error Handling: Graceful degradation when API endpoints fail
  4. Progress Tracking: Rich console progress bars for batch downloads
  5. Metadata Preservation: Maintains all original JioSaavn metadata

Tumblr Handler

File: handlers/tumblr_handler.py

The Tumblr Handler downloads images and videos from Tumblr blogs using the Tumblr API.

Architecture

Loading diagram...

TumblrAPI Class

The handler includes a built-in API wrapper:

MethodPurpose
get_blog_posts()Fetch posts from a blog
get_post_media()Extract media URLs from a post
_call()Make authenticated API requests

Supported Media Types

  • Images (JPG, PNG, GIF)
  • Videos (MP4)
  • Multi-image posts (photo sets)
  • Video posts

Key Features

  • Pagination support for large blogs
  • Progress tracking during download
  • Automatic filename sanitization
  • Skips already downloaded files

LinkedIn Handler

File: handlers/linkedin_handler.py

Handles downloading videos and images from LinkedIn direct post URLs. Profile scraping is not supported due to authentication requirements.

Supported Content Types

| Content Type | URL Pattern | Example | |--------------|-------------|---------|| | Direct Post | /posts/username_POST_ID | https://www.linkedin.com/posts/username_POST_ID | | Feed Post | /feed/update/urn:li:activity:... | https://www.linkedin.com/feed/update/... |

LinkedIn Architecture

Loading diagram...

Key Features

  • Direct post URL support only (no profile scraping)
  • Video and image extraction
  • Multiple fallback methods
  • Rich progress bars with download speed
  • No Selenium dependency (faster and more reliable)
  • User agent rotation
  • Cloudflare bypass support

Limitations

  • Profile scraping removed due to authentication requirements
  • Only works with publicly accessible posts
  • May require cookies for private content

Pinterest Handler

File: handlers/pinterest_handler.py

Handles downloading images and videos from Pinterest pins, boards, and user profiles with advanced multi-tier download strategy.

Supported Content Types

| Content Type | URL Pattern | Example | |--------------|-------------|---------|| | Single Pin | /pin/PIN_ID/ | https://www.pinterest.com/pin/123456789/ | | Board | /username/board-name/ | https://www.pinterest.com/username/travel-photos/ | | User Profile | /username/ | https://www.pinterest.com/username/ | | Short Link | pin.it/... | https://pin.it/abc123 |

Pinterest Architecture

Loading diagram...

Multi-Tier Download Strategy

The handler uses multiple methods in order of preference:

  1. gallery-dl - Most reliable, supports boards and profiles
  2. pinterest-downloader - Alternative library for Pinterest
  3. yt-dlp - Generic extractor
  4. Web Scraping - Fallback with 10 regex patterns and 7 extraction methods

Key Features

  • Multi-tier download strategy for maximum reliability
  • Interactive prompt for custom pin count
  • Real-time progress tracking with file names
  • High-quality media selection (1000px+ images)
  • 10 regex patterns for robust scraping
  • Support for profiles, boards, and individual pins
  • No metadata JSON files (clean downloads)
  • ZIP file creation for bulk downloads
  • User agent rotation and proxy support

Pinterest API

The handler can use gallery-dl which interfaces with Pinterest's internal API:

| Tool | Purpose | |------|---------|| | gallery-dl | Primary download tool | | pinterest-downloader | Alternative download tool | | Web scraping | Fallback extraction method |


Reddit Handler

File: handlers/reddit_handler.py

Handles downloading videos, images, and GIFs from Reddit posts and user profiles with PRAW (Python Reddit API Wrapper) integration.

Supported Content Types

| Content Type | URL Pattern | Example | |--------------|-------------|---------|| | Single Post | /r/subreddit/comments/POST_ID/title/ | https://www.reddit.com/r/videos/comments/abc123/title/ | | User Posts | /user/username/ | https://www.reddit.com/user/username/ | | User Profile | /u/username/ | https://www.reddit.com/u/username/ | | Short Link | redd.it/POST_ID | https://redd.it/abc123 |

Reddit Architecture

Loading diagram...

PRAW Integration

The handler can use PRAW for API access:

| Method | Purpose | |--------|---------|| | submission() | Get post by ID | | redditor().submissions.new() | Get user posts | | subreddit().hot() | Get subreddit posts |

Configuration

Optional Reddit API credentials for enhanced functionality:

# Set environment variables
export REDDIT_CLIENT_ID="your_client_id"
export REDDIT_CLIENT_SECRET="your_client_secret"
export REDDIT_USER_AGENT="python:ultimate-downloader:v1.0"

Without API credentials, the handler uses yt-dlp and web scraping.

Key Features

  • PRAW integration for API access
  • Bulk user post downloads
  • Automatic ZIP file creation
  • Support for videos, images, and GIFs
  • Progress tracking with Rich
  • Fallback to yt-dlp and web scraping
  • Handles v.redd.it and i.redd.it domains
  • User agent rotation
  • Configurable post limits

Media Types Supported

  • Videos (v.redd.it)
  • Images (i.redd.it)
  • GIFs (hosted and external)
  • Gallery posts (multiple images)
  • Cross-posts
  • External media (imgur, gfycat, etc.)

Instagram Handler

File: handlers/instagram_handler.py

The Instagram Handler enables downloading posts, reels, stories, and images from Instagram using Playwright for browser automation. Supports bulk downloads with ZIP creation and range selection.

Supported Content Types

Content TypeURL PatternExample
Single Post/p/POST_IDhttps://instagram.com/p/ABC123
Single Reel/reel/REEL_ID or /reels/REEL_IDhttps://instagram.com/reel/XYZ789
IGTV Video/tv/VIDEO_IDhttps://instagram.com/tv/DEF456
Stories/stories/USERNAMEhttps://instagram.com/stories/username
Profile Posts/USERNAME/https://instagram.com/username
Profile Reels/USERNAME/reels/https://instagram.com/username/reels

Architecture

Loading diagram...

Processing Flow

Loading diagram...

Key Features

  • Playwright Integration: Uses headless browser automation for reliable extraction
  • Cookie Persistence: Saves and reuses cookies to avoid repeated logins
  • Bulk Downloads: Download entire profiles or specific ranges
  • ZIP Creation: Bundle downloads into ZIP files for easy sharing
  • Range Selection: Download posts 1-10, 5-20, etc.
  • Story Support: Download temporary stories before they expire
  • Multi-format: Handles images, videos, carousels, and reels
  • Progress Tracking: Rich progress bars with file names and status
  • Error Recovery: Continues downloading remaining content if one item fails
  • User-Agent Rotation: Random user agents to avoid detection

The handler looks for cookies in two locations:

  1. cookies.json in project directory (preferred)
  2. ~/.instagram_cookies.json in home directory (fallback)

Cookies are automatically saved after successful sessions:

# Cookie format
[
    {
        "name": "sessionid",
        "value": "...",
        "domain": ".instagram.com",
        "path": "/",
        "secure": true,
        "httpOnly": true
    }
]

Profile Download Options

When downloading from a profile URL, users are presented with an interactive menu:

OptionDescription
1Download all posts (photos and videos)
2Download all reels
3Download active stories
4Download specific range (e.g., posts 1-20)
5Download as ZIP file (bundled)

Range Selection

Users can specify exact ranges when downloading:

# Examples
Enter range: 1-10      # Download posts 1 through 10
Enter range: 5-25      # Download posts 5 through 25
Enter range: 1-50      # Download posts 1 through 50

Dependencies

The handler requires:

  • Playwright: Browser automation
  • BeautifulSoup: HTML parsing
  • Requests: HTTP requests with retry logic
  • Rich: Progress bars and UI

Installation

# Install Playwright
pip install playwright
playwright install chromium

# Other dependencies
pip install beautifulsoup4 requests rich

Usage Examples

# Download single post
umd https://instagram.com/p/ABC123

# Download single reel
umd https://instagram.com/reel/XYZ789

# Download profile (shows menu)
umd https://instagram.com/username

# Download profile reels (direct)
umd https://instagram.com/username/reels/

# Download stories
umd https://instagram.com/stories/username

Error Handling

The handler implements robust error handling:

  • Login Required: Prompts to provide cookies.json
  • Private Account: Notifies that authentication is needed
  • Rate Limiting: Implements delays between requests
  • Network Errors: Retries failed downloads
  • Invalid URLs: Clear error messages

Technical Implementation

FeatureTechnology
Browser AutomationPlaywright (Chromium)
HTML ParsingBeautifulSoup4
HTTP RequestsRequests + HTTPAdapter with retry
Progress DisplayRich Console and Progress Bars
Cookie ManagementJSON file storage
User AgentRandom rotation from list

Supported Media Formats

  • Images: JPG, PNG, WebP
  • Videos: MP4, MOV
  • Carousels: Multiple images/videos in one post
  • Reels: Short-form videos
  • Stories: Temporary 24-hour content

Key Methods

MethodPurpose
can_handle(url)Check if URL is Instagram
download(url, output_dir)Main download entry point
_download_single_post(url)Download specific post/reel
_download_profile_posts(username)Download from profile
_download_stories(url)Download stories
_handle_profile_download(username)Interactive menu for profiles
_init_browser()Initialize Playwright browser
_save_cookies()Persist cookies for reuse

Limitations

  • Authentication Required: Private accounts need valid cookies
  • Rate Limiting: Instagram may block excessive requests
  • Stories Expiration: Stories only available for 24 hours
  • Playwright Dependency: Requires browser installation

Pornhub Handler

File: handlers/pornhub_handler.py

Handles video downloads from Pornhub with age verification bypass.

Session Management

Loading diagram...

The handler automatically sets cookies to bypass age verification:

cookies = {
    'age_verified': '1',
    'accessAgeDisclaimerPH': '1',
    'accessPH': '1'
}

Supported Content

ContentURL Pattern
Single Video/view_video.php?viewkey=xxx
Channelpornhub.com/channels/xxx
Modelpornhub.com/model/xxx
Playlistpornhub.com/playlist/xxx

Key Features

  • Automatic age verification bypass
  • Quality selection (best, 720p, 480p, etc.)
  • Channel and playlist downloading
  • User agent rotation

XNXX Handler

File: handlers/xnxx_handler.py

Downloads videos from XNXX and its mirror domains.

Supported Domains

The handler recognizes multiple domain variations:

  • xnxx.com
  • xnxx.dev
  • xnxx.tv
  • xnxx2.com, xnxx3.com, etc.

Processing Flow

Loading diagram...

Key Features

  • Multiple domain support
  • Fallback extraction methods
  • SSL bypass for problematic connections

xHamster Handler

File: handlers/xhamster_handler.py

Handles downloads from xHamster including videos and photo galleries.

Supported Content Types

ContentDescription
VideosStandard video pages
ChannelsChannel video listings
Photo GalleriesImage collections
CategoriesCategory browsing

Domain Support

The handler recognizes various mirror domains:

patterns = [
    'xhamster',
    'xhwebsite', 
    'xhofficial',
    'xhlocal',
    'xhopen',
    'xhtotal',
    'megaxh',
    'xhwide',
    'xhtab',
    'xhtime'
]

Key Features

  • Mirror domain detection
  • Photo gallery extraction
  • Video quality selection
  • Rate limiting to avoid bans

HiAnime Handler

File: handlers/hianime_handler.py

Handles anime downloads from HiAnime with episode extraction and metadata support.

Supported Content Types

ContentDescription
Anime SeriesFull series with all episodes
EpisodesIndividual episode downloads
MoviesAnime movie files
MangaManga chapter collections

Processing Flow

Loading diagram...

Key Features

  • Automatic episode detection
  • Metadata extraction (title, synopsis, cover art)
  • Multiple stream quality support
  • Batch series downloading
  • Episode number formatting

TikTok Handler

File: handlers/tiktok_handler.py

The TikTok Handler downloads videos from TikTok with proper SSL handling and anti-bot bypass.

TikTok Supported Domains

The handler recognizes multiple TikTok domain variations:

  • tiktok.com
  • www.tiktok.com
  • vm.tiktok.com (shortened URLs)
  • m.tiktok.com (mobile)
  • vt.tiktok.com

TikTok Processing Flow

Loading diagram...

TikTok Key Features

  • Multiple domain support including shortened URLs
  • SSL/TLS bypass for problematic connections
  • User agent rotation
  • Watermark-free download attempts
  • Mobile and desktop URL handling

Eporner Handler

File: handlers/eporner_handler.py

Handles video downloads from Eporner with advanced SSL bypass and multiple fallback methods.

Eporner Supported Content

ContentDescription
VideosStandard video pages
CategoriesCategory browsing
Search ResultsSearch page videos

Eporner Processing Flow

Loading diagram...

Eporner Key Features

  • Advanced SSL/TLS bypass with permissive context
  • Multiple fallback extraction methods (yt-dlp, curl_cffi, requests)
  • Quality selection support
  • Rate limiting to avoid bans
  • User agent rotation

HQPorner Handler

File: handlers/hqporner_handler.py

Downloads high-quality videos from HQPorner with SSL handling and fallback methods.

HQPorner Supported Domains

HQPorner Processing Flow

Loading diagram...

HQPorner Key Features

  • Custom SSL adapter for certificate issues
  • High-quality video extraction
  • Multiple resolution support
  • Fallback extraction methods
  • User agent rotation

Beeg Handler

File: handlers/beeg_handler.py

Handles video downloads from Beeg using their API and fallback methods including subprocess curl.

Beeg Architecture

Loading diagram...

Beeg API Integration

The handler uses Beeg's internal API for video information:

EndpointPurpose
store.externulls.comVideo metadata API
video.beeg.comVideo CDN

Beeg Key Features

  • Native API integration for reliable extraction
  • Subprocess curl fallback for SSL issues
  • Multiple quality options
  • Progress bar display with Rich
  • SSL context customization

4K Wallpapers Handler

File: handlers/four_k_wallpapers_handler.py

The 4K Wallpapers Handler enables browsing and downloading high-resolution wallpapers from 4kwallpapers.com. Unlike media handlers that use yt-dlp, this handler performs direct web scraping using cloudscraper and BeautifulSoup.

How It Works

Loading diagram...

Supported URL Types

URL PatternBehaviour
https://4kwallpapers.com/ (root)Opens interactive_browse()
https://4kwallpapers.com/<category>/Category listing (paginated)
https://4kwallpapers.com/search/?q=querySearch results (single page, 24 max)
https://4kwallpapers.com/cat/slug-ID.htmlSingle wallpaper download

Key Methods

MethodDescription
interactive_browse(search_query='')Main menu shown when user runs --wallpaper or types wallpaper in interactive mode
handle_url(url)Auto-detects the URL type and routes to the appropriate flow
fetch_listing(url)Fetches wallpapers from a single page
fetch_listing_paginated(base_url, max_wallpapers=200)Paginates via ?page=N, deduplicates by ID, stops on <20 results or duplicates
search_wallpapers(query)Queries https://4kwallpapers.com/search/?q=<query> — single page only
fetch_popular_tags()Scrapes live tag links from the homepage navigation
_parse_wallpaper_listing(html)Parses <a href="...cat/slug-ID.html"> links from listing HTML
_parse_download_links(html)Extracts /images/wallpapers/ hrefs with resolution regex (\d{3,5}x\d{3,5})
_parse_selection(raw, total)Converts "1,3,4-7,10-12" / "all" to sorted 0-based index list
_ask_selection(total)Interactive prompt that calls _parse_selection
_run_listing_flow(section_name, listing_url)Full browse → select → download flow for any listing URL

Selection Syntax

The handler supports rich range-based selection:

all          → all wallpapers
1            → wallpaper #1 only
1,3,7        → wallpapers 1, 3, and 7
1-10         → wallpapers 1 through 10
1-5,8,10-15  → combined ranges
(Enter)      → skip / cancel

Pagination Details

  • Each page returns 24 wallpapers
  • Pages are fetched via ?page=N query parameter
  • Fetching stops when:
    • A page returns fewer than 20 results (last page reached)
    • All wallpapers on the current page already exist in the set (duplicates detected)
    • The max_wallpapers limit is reached

Cloudflare Bypass

The handler uses a bare cloudscraper.create_scraper() session (no browser= argument). Passing browser emulation arguments was found to trigger Cloudflare's challenge page (returning 8 KB instead of the expected 55 KB response). The bare session passes Cloudflare checks reliably.

Download URL Format

https://4kwallpapers.com/images/wallpapers/<slug>-<WxH>-<id>.png

Example:

https://4kwallpapers.com/images/wallpapers/anime-girl-3840x2160-12345.png

YouTube Music Handler

File: handlers/youtube_music_handler.py

The YouTube Music Handler downloads tracks, albums, and playlists from music.youtube.com. It uses the YouTube Music Innertube API to bypass extraction limits and fetch complete playlists.

Supported Content Types

Content TypeURL PatternExample
Single Track/watch?v=...https://music.youtube.com/watch?v=xxx
Playlist/playlist?list=...https://music.youtube.com/playlist?list=xxx
Album/Browse/browse/...https://music.youtube.com/browse/xxx

Processing Flow

Loading diagram...

Key Features

  • Innertube API Integration: Uses the 'next' API with continuation tokens to fetch ALL tracks in a playlist (bypassing the usual 100-track limit).
  • Concurrent Downloading: Uses parallel workers for maximum speed when downloading playlists and albums.
  • Rich Metadata Extraction: High-quality metadata embedding including title, artist, album, and thumbnail.
  • yt-dlp Fallback: Seamless fallback extraction if the primary API fails.
  • Interactive UI: Rich progress bars and track selection UI.

Amazon Music Handler

File: handlers/amazon_music_handler.py

The Amazon Music Handler enables downloading music from Amazon Music by extracting metadata and searching for equivalent content on YouTube.

Supported Content Types

Content TypeURL PatternExample
Track/albums/...https://music.amazon.com/albums/xxx?trackAsin=yyy
Album/albums/...https://music.amazon.com/albums/xxx
Playlist/playlists/...https://music.amazon.com/playlists/xxx
Artist/artists/...https://music.amazon.com/artists/xxx

Key Features

  • High-quality metadata embedding (title, artist, album)
  • Automatic album and playlist downloading
  • YouTube search and scoring integration for accurate matching
  • Interactive download capabilities

Boomplay Handler

File: handlers/boomplay_handler.py

The Boomplay Handler supports downloading music from the Boomplay platform, commonly used for African music.

Supported Content Types

Content TypeURL PatternExample
Track/songs/...https://www.boomplay.com/songs/xxx
Album/albums/...https://www.boomplay.com/albums/xxx
Playlist/playlists/...https://www.boomplay.com/playlists/xxx
Artist/artists/...https://www.boomplay.com/artists/xxx

Key Features

  • Full metadata extraction via web scraping
  • Batch downloading for albums and playlists
  • YouTube fallback for actual audio retrieval

Audiomack Handler

File: handlers/audiomack_handler.py

The Audiomack Handler downloads songs, albums, and playlists from Audiomack by fetching metadata and using YouTube for high-quality audio downloads.

Supported Content Types

Content TypeURL PatternExample
Song/song/...https://audiomack.com/user/song/xxx
Album/album/...https://audiomack.com/user/album/xxx
Playlist/playlist/...https://audiomack.com/user/playlist/xxx
Artist/artist/...https://audiomack.com/user

Key Features

  • Comprehensive metadata extraction
  • Support for artist discographies
  • Intelligent YouTube scoring for accuracy

Dailymotion Handler

File: handlers/dailymotion_handler.py

Downloads video content from Dailymotion, supporting both single videos and collections.

Supported Content Types

Content TypeURL PatternExample
Single Video/video/...https://www.dailymotion.com/video/xxx
Collection`/(userplaylist)/...`

Key Features

  • High-resolution video extraction (up to 4K if available)
  • Channel/collection batch downloading
  • Robust yt-dlp integration

Vimeo Handler

File: handlers/vimeo_handler.py

The Vimeo Handler specializes in downloading Vimeo videos, including support for password-protected content.

Supported Content Types

Content TypeURL PatternExample
Single Videovimeo.com/...https://vimeo.com/xxx
Collection/channels/...https://vimeo.com/channels/xxx

Key Features

  • Password support for private videos
  • High-quality format selection
  • Collection/channel downloads

Rumble Handler

File: handlers/rumble_handler.py

Downloads videos and channels from the Rumble platform.

Supported Content Types

Content TypeURL PatternExample
Single Videorumble.com/...https://rumble.com/xxx.html
Channel/c/...https://rumble.com/c/xxx

Key Features

  • Direct single video downloads
  • Complete channel archival support
  • Format and quality selection

Twitch Handler

File: handlers/twitch_handler.py

The Twitch Handler downloads VODs, Clips, and Live Streams from Twitch.

Supported Content Types

Content TypeURL PatternExample
VOD/videos/...https://www.twitch.tv/videos/xxx
Clipclips.twitch.tv/...https://clips.twitch.tv/xxx
Live Streamtwitch.tv/...https://www.twitch.tv/xxx

Key Features

  • Live stream recording capabilities
  • Cookie support for subscriber-only VODs
  • Batch VOD list downloading
  • Quality and format options

Kick Handler

File: handlers/kick_handler.py

Downloads VODs and Live Streams from the Kick streaming platform.

Supported Content Types

Content TypeURL PatternExample
VOD/video/...https://kick.com/video/xxx
Live Streamkick.com/...https://kick.com/xxx

Key Features

  • Live stream capture
  • VOD extraction with metadata
  • yt-dlp integration with platform-specific options

TED Handler

File: handlers/ted_handler.py

Downloads TED Talks with support for specific subtitle languages and entire collections.

Supported Content Types

Content TypeURL PatternExample
Talk/talks/...https://www.ted.com/talks/xxx
Collection/playlists/...https://www.ted.com/playlists/xxx

Key Features

  • Subtitle language selection
  • High-quality video extraction
  • Playlist and series support

BitChute Handler

File: handlers/bitchute_handler.py

Downloads videos and channel content from BitChute.

Supported Content Types

Content TypeURL PatternExample
Single Video/video/...https://www.bitchute.com/video/xxx
Channel/channel/...https://www.bitchute.com/channel/xxx

Key Features

  • Direct video downloads
  • Channel enumeration and batch downloading
  • Quality selection

Flickr Handler

File: handlers/flickr_handler.py

Downloads photos and albums from Flickr.

Supported Content Types

Content TypeURL PatternExample
Single Photo/photos/.../...https://www.flickr.com/photos/user/xxx
Album/albums/...https://www.flickr.com/photos/user/albums/xxx
User Stream/photos/...https://www.flickr.com/photos/user/

Key Features

  • Downloads original/high-resolution images
  • Album batch downloading
  • User photostream downloading

PeerTube Handler

File: handlers/peertube_handler.py

Downloads content from PeerTube instances (decentralized video hosting).

Supported Content Types

Content TypeURL PatternExample
Single Video/w/...https://peertube.example.com/w/xxx
Channel/c/...https://peertube.example.com/c/xxx
Playlist/w/p/...https://peertube.example.com/w/p/xxx

Key Features

  • Supports any valid PeerTube instance URL
  • Video, channel, and playlist downloads
  • Interactive format selection

Veoh Handler

File: handlers/veoh_handler.py

Downloads videos and user channels from Veoh.

Supported Content Types

Content TypeURL PatternExample
Single Video/watch/...https://www.veoh.com/watch/xxx
User Channel/users/...https://www.veoh.com/users/xxx

Key Features

  • Direct video retrieval
  • User channel batch downloads
  • Format selection support

TrillerTV Handler

File: handlers/trillertv_handler.py

Downloads videos and shows from TrillerTV (formerly FITE).

Supported Content Types

Content TypeURL PatternExample
Single Video/watch/...https://www.trillertv.com/watch/xxx
Show/Event/vl/...https://www.trillertv.com/vl/xxx

Key Features

  • Video extraction with quality selection
  • Event/show page parsing
  • Interactive batch downloading

Creating Custom Handlers

If you want to add support for a new platform, follow this guide.

Step 1: Create Handler File

Create a new file in handlers/ directory:

#!/usr/bin/env python3
"""
NewPlatform Handler Module
"""

import warnings
warnings.filterwarnings('ignore')

try:
    from rich.console import Console
    RICH_AVAILABLE = True
except ImportError:
    RICH_AVAILABLE = False

from utils.utils import sanitize_filename
from utils.ui_components import Icons, Messages


class NewPlatformHandler:
    """Handles downloads from NewPlatform"""
    
    def __init__(self, downloader):
        """Initialize handler with reference to main downloader"""
        self.downloader = downloader
        self.console = Console() if RICH_AVAILABLE else None
    
    def _print(self, message):
        """Print with Rich if available"""
        if self.console:
            self.console.print(message)
        else:
            print(message)
    
    def search_and_download(self, url, interactive=True):
        """Main entry point for downloading
        
        Args:
            url: URL to download from
            interactive: Whether to prompt user for options
            
        Returns:
            True if successful, False/None otherwise
        """
        # Implement your download logic here
        pass
    
    @classmethod
    def is_supported_url(cls, url):
        """Check if URL belongs to this platform"""
        return 'newplatform.com' in url.lower()

Step 2: Register Handler in Main Downloader

Edit ultimate_downloader.py to import and initialize your handler:

# At the top of the file
try:
    from handlers.newplatform_handler import NewPlatformHandler
    NEWPLATFORM_HANDLER_AVAILABLE = True
except ImportError:
    NEWPLATFORM_HANDLER_AVAILABLE = False

# In __init__ method
if NEWPLATFORM_HANDLER_AVAILABLE:
    self.newplatform_handler = NewPlatformHandler(self)

Step 3: Add Platform Detection

Edit utils/platform_utils.py:

# In detect_platform function
elif 'newplatform.com' in url_lower:
    return 'newplatform'

Step 4: Add Configuration

Edit config.json if your handler needs settings:

{
    "newplatform": {
        "enabled": true,
        "api_key": ""
    }
}

Handler Best Practices

  1. Graceful Degradation: Always check if dependencies are available
  2. Error Handling: Catch exceptions and provide meaningful error messages
  3. Logging: Use the _print method for consistent output
  4. Rate Limiting: Add delays between requests to avoid getting blocked
  5. Fallbacks: Implement multiple extraction methods when possible

Summary

The handler system provides a flexible way to support different platforms. Each handler encapsulates the platform-specific logic while delegating common tasks (like actual downloading) to the main downloader class.

When adding new platforms:

  • Follow the established patterns
  • Test thoroughly with different URL types
  • Handle errors gracefully
  • Document the supported content types

For questions about handler development, refer to the existing handlers as examples.