Skip to main content

Crate youtube_chapter_splitter

Crate youtube_chapter_splitter 

Source
Expand description

YouTube Chapter Splitter - Library for downloading and splitting YouTube videos.

This library provides tools for:

  • Downloading YouTube videos and extracting audio to MP3
  • Parsing chapters from YouTube metadata
  • Splitting audio into individual tracks based on chapters
  • Adding complete ID3 metadata and album cover art

§Example Usage

use youtube_chapter_splitter::{audio, downloader, yt_dlp_progress, Result};
use std::path::PathBuf;

fn main() -> Result<()> {
    let url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";

    // Fetch video information
    let video_info = downloader::get_video_info(url)?;

    // Download audio with real-time progress
    let output_path = PathBuf::from("temp_audio");
    let audio_file = yt_dlp_progress::download_audio_with_progress(
        url,
        &output_path,
        None, // cookies_from_browser
        None, // progress bar (auto-created)
        None, // shared progress for TUI
    )?;

    // Split by chapters
    let output_dir = PathBuf::from("output");
    audio::split_audio_by_chapters(
        &audio_file,
        &video_info.chapters,
        &output_dir,
        "Artist Name",
        "Album Name",
        None,
    )?;

    Ok(())
}

§Modules

  • error - Custom error handling
  • chapters - Chapter structures and parsing
  • downloader - Video downloading and metadata
  • audio - Audio processing and splitting
  • utils - Utility functions (formatting, cleaning)
  • config - Configuration management
  • playlist - Playlist detection and handling

Re-exports§

pub use chapters::Chapter;
pub use config::Config;
pub use downloader::VideoInfo;
pub use error::Result;
pub use error::YtcsError;

Modules§

audio
Audio processing and chapter-based splitting.
chapter_refinement
Chapter refinement by silence detection.
chapters
YouTube video chapter management.
chapters_from_description
Chapter extraction from YouTube video descriptions.
config
Persistent configuration management module
cookie_helper
Helper functions for cookie management with yt-dlp.
dependency
Dependency detection and installation module
downloader
YouTube video download and metadata extraction.
error
Error handling for YouTube Chapter Splitter.
error_handler
Centralized error handling with TUI modal support
playlist
YouTube playlist management module.
progress
Module for managing progress bars
temp_file
RAII temporary file management module
ui
Minimalist user interface module
utils
yt_dlp_progress
Module for parsing yt-dlp progress in real time.
yt_dlp_update
yt-dlp auto-update functionality
ytdlp_error_parser
Parser for yt-dlp error messages to provide user-friendly error messages.
ytdlp_helper
Helper functions for yt-dlp version management and auto-update.