| Crates.io | youtubeinfo-sync |
| lib.rs | youtubeinfo-sync |
| version | 1.0.2 |
| created_at | 2025-12-24 19:17:46.368481+00 |
| updated_at | 2025-12-24 19:32:58.722151+00 |
| description | Download YouTube video and channel metadata |
| homepage | |
| repository | https://codeberg.org/houston-open-source-society/youtubeinfo-sync |
| max_upload_size | |
| id | 2003708 |
| size | 105,805 |
A command-line tool to download and sync YouTube video and channel metadata using the YouTube Data API v3.
Requires Rust 1.85+ (2024 edition).
git clone https://codeberg.org/evancarroll/youtubeinfo-sync.git
cd youtubeinfo-sync
cargo build --release
The binary will be at target/release/youtubeinfo-sync.
Obtain a YouTube Data API v3 key from the Google Cloud Console and set it as an environment variable:
export YOUTUBE_API_KEY="your-api-key-here"
Create a TOML configuration file (see example_config.toml):
# Output directory for all generated files
output_dir = "./output"
# Global default: whether to fetch channel data for video authors
sync_channels = false
# Define one or more feeds
[[feed]]
name = "music"
videoids = ["dQw4w9WgXcQ", "9bZkp7q19f0"]
sync_channels = true # Override: sync channels for this feed
[[feed]]
name = "gaming"
videoids = ["jNQXAC9IVRw"]
# Inherits global sync_channels = false
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
output_dir |
string | No | "./output" |
Base directory for output files |
sync_channels |
boolean | No | false |
Global setting to fetch channel metadata |
feed |
array | Yes | - | List of feed configurations |
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | - | Feed name (used as output subdirectory) |
videoids |
array | Yes | - | List of 11-character YouTube video IDs |
sync_channels |
boolean | No | inherited | Per-feed override for channel syncing |
/, \)youtubeinfo-sync batch --batch-file config.toml
youtubeinfo-sync batch --batch-file config.toml --output-dir /path/to/output
Usage: youtubeinfo-sync batch [OPTIONS] --batch-file <BATCH_FILE>
Options:
-b, --batch-file <BATCH_FILE> Path to TOML configuration file
-o, --output-dir <OUTPUT_DIR> Output directory (overrides config file)
-h, --help Print help
Control log verbosity with the RUST_LOG environment variable:
# Default info level
youtubeinfo-sync batch --batch-file config.toml
# Debug logging
RUST_LOG=debug youtubeinfo-sync batch --batch-file config.toml
# Trace logging (very verbose)
RUST_LOG=trace youtubeinfo-sync batch --batch-file config.toml
output/
├── feeds/
│ ├── music/
│ │ └── videos.json # Map of videoId -> video object
│ └── gaming/
│ └── videos.json
└── channels/
└── channels.json # Map of channelId -> channel object
videos.json - Object mapping video IDs to video metadata for each feedchannels.json - Object mapping channel IDs to channel metadata (only created if sync_channels is enabled for any feed)See SCHEMA.md for detailed JSON schema documentation.
The YouTube Data API v3 has a default quota of 10,000 units per day.
| Operation | Cost |
|---|---|
| videos.list | 1 unit per request |
| channels.list | 1 unit per request |
This tool batches up to 50 IDs per request to minimize quota usage:
| Videos | Requests | Quota Used |
|---|---|---|
| 50 | 1 | 1 unit |
| 100 | 2 | 2 units |
| 500 | 10 | 10 units |
| 1,000 | 20 | 20 units |
sync_channels selectively - Only enable for feeds where you need channel dataThe tool automatically:
quotaExceeded reason)| Code | Meaning |
|---|---|
| 0 | Success - all feeds processed |
| 1 | Partial failure - some feeds failed |
| 2 | Complete failure - all feeds failed or configuration error |
# music.toml
output_dir = "./data"
[[feed]]
name = "favorites"
videoids = [
"dQw4w9WgXcQ", # Rick Astley - Never Gonna Give You Up
"9bZkp7q19f0", # PSY - Gangnam Style
"kJQP7kiw5Fk", # Luis Fonsi - Despacito
]
sync_channels = true
youtubeinfo-sync batch --batch-file music.toml
# playlists.toml
output_dir = "./youtube-data"
sync_channels = false
[[feed]]
name = "tech-reviews"
videoids = ["video1", "video2", "video3"]
[[feed]]
name = "tutorials"
videoids = ["video4", "video5"]
sync_channels = true # Only sync channels for tutorials
Ensure YOUTUBE_API_KEY is set:
echo $YOUTUBE_API_KEY # Should print your key
You've hit the daily quota limit. Options:
Some videos may be unavailable due to:
The tool logs warnings for missing videos but continues processing.
This tool is used to generate the video metadata for Evan Carroll's Classes, a static site where the data is used to generate video listings.
Copyright © 2025 Evan Carroll
This software is licensed under the Anti-Capitalist Software License (v 1.4).
See LICENSE.md for full license text, or visit https://anticapitalist.software/