Skip to content

ScottWilliamAnderson/save-subscriptions

Repository files navigation

YouTube Subscriptions Exporter

Export your YouTube subscriptions from a saved HTML page to a CSV file that matches Google Takeout format.

Overview

This tool helps you backup your YouTube subscriptions by:

  1. Parsing a saved HTML page of your YouTube subscriptions
  2. Extracting channel information using yt-dlp
  3. Exporting to a CSV file compatible with Google Takeout

Prerequisites

Installation

# Clone the repository
git clone https://github.com/yourusername/save-subscriptions.git
cd save-subscriptions

# Install using uv
uv sync

Usage

Step 1: Save Your Subscriptions Page

  1. Install the SingleFile browser extension
  2. Navigate to your YouTube subscriptions page
  3. Click the dropdown arrow to sort channels A-Z
  4. Scroll to the bottom to load all channels
  5. Click the SingleFile extension icon to save the page
  6. Save the HTML file to the data/ folder in this project

Step 2: Run the Export

# Basic usage - processes all HTML files in data/ folder
uv run save-subscriptions

# With browser cookies (recommended for age-restricted content)
uv run save-subscriptions --browser chrome
uv run save-subscriptions --browser firefox

# Specify input file
uv run save-subscriptions data/subscriptions.html

# Specify output location
uv run save-subscriptions data/subscriptions.html -o my-subscriptions.csv

# Use a cookies file
uv run save-subscriptions --cookies-file cookies.txt

# Show help
uv run save-subscriptions --help

Handling Age-Restricted Content

If you encounter errors about age-restricted content or authentication, use the --browser option to extract cookies from your browser:

# Extract cookies from Chrome
uv run save-subscriptions --browser chrome

# Extract cookies from Firefox
uv run save-subscriptions --browser firefox

Supported browsers: chrome, firefox, edge, safari, brave, chromium, opera, vivaldi

Note: Make sure you're logged into YouTube in the browser you specify.

Output Format

The tool generates a CSV file matching Google Takeout format:

Channel ID,Channel URL,Channel title
UC--x42Wg-c4nRydL4mJJdaA,http://www.youtube.com/channel/UC--x42Wg-c4nRydL4mJJdaA,VineArmy

Development

Setup Development Environment

# Install dependencies
uv sync

# Install pre-commit hooks
uv run pre-commit install

# Run tests
uv run coverage

# Run linting
uv run ruff check .
uv run ruff format .

Troubleshooting

  • yt-dlp not found: Ensure yt-dlp is installed and in your PATH
  • No channels found: Check that the HTML file contains your full subscriptions page
  • Network errors: The tool needs internet access to fetch channel metadata
  • Age-restricted content: Use --browser option to extract cookies from your browser
  • 404 errors: Some channels may have been deleted or made private

License

MIT License - see LICENSE file for details

About

Export YouTube subscriptions from a saved HTML page to CSV format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages