CLI tool to mirror YouTube playlists into local directories
Project description
sync-yt
sync-yt is a command-line tool that synchronizes YouTube playlists to local directories on your system. It uses yt-dlp for downloading videos and a JSON based configuration file to define playlists and other options.
Features
- Declarative config.json to specify playlists and other configurable options.
- Option to save playlists in audio-only format, useful for music playlists.
- Can sync private YouTube playlists by specifying the logged-in browser.
- Automatically skips repeated video entries.
- Detects videos which become unavailable.
- Add metadata and thumbnail to audio files
Requirements
- Python 3.10+
- yt-dlp
- FFmpeg (Optional but highly recommended)
Installation
-
Windows
-
Install FFmpeg
Follow this guide to properly install FFmpeg on Windows. -
Install
sync-yt$ pip install sync-yt
-
-
Arch Linux
sync-ytis available on AUR. Use your favourite AUR helper.$ yay -S sync-yt -
Other Linux Distributions / macOS
Since
sync-ytrequires the latest version ofyt-dlp, which may not be available in your OS’s official repositories, usingpipxis recommended.-
Install
pipxDebain and derivatives (Ubuntu, Mint, Zorin etc..)
$ sudo apt install pipxmacOS
$ brew install pipx -
Install
sync-yt$ pipx ensurepath $ pipx install sync-yt
-
Configuration
Configuration file is first searched at ~/.config/sync-yt/config.json on POSIX compliant systems or at
C:\Users\<User>\AppData\Local\sync-yt\config.json on Windows.
config.json
sync_dir
- Type:
string - Description: Specifies the local directory where YouTube playlist folders will be synced. This path can be relative to the user's home directory (using
~) or an absolute path. - Examples:
"~/Music" , "D:\YouTube"
cookies_from_browser
- Type:
string - Description: Specifies the browser from which cookies should be extracted. This is required for downloading private playlists that are accessible only when signed into a Google account. Supported browsers include
firefox,chrome,edge, etc. You can choose to leave this option blank if you're not downloading private playlists. - Examples:
"firefox", "chrome", "brave", "edge", "vivaldi"
playlists
-
Type:
array -
Description: An array of playlist objects, where each object represents a YouTube playlist to be synced. Each object in the array has the following properties:
-
name- Type:
string - Description: A descriptive name to refer the playlist. This is the name of folder created in
sync_dirwhere corresponding playlist is synced.
- Type:
-
url- Type:
string - Description: The URL of the YouTube playlist.
- Example:
"https://www.youtube.com/playlist?list=PLSdoVPM5WnndSQEXRz704yQkKwx76GvPV"
- Type:
-
convert_to_audio- Type:
boolean - Description: Indicates whether the videos in the playlist should be converted to audio files. Set it to
trueif you want an audio file. If the entry is omitted, it will be set tofalseby default.
- Type:
-
format- Type:
string - Description: Indicate the audio or video codec you want. If the entry is omitted, it will be set to
bestby default.- Supported video formats:
avi, flv, mkv, mov, mp4, webm - Supported audio formats (requires
convert_to_audioset totrue):aac, alac, flac, m4a, mp3, opus, vorbis, wav
- Supported video formats:
- Example:
"mp3"or"mkv"
- Type:
-
Example Configuration
Below is a sample config.json file demonstrating the use of the configuration options:
{
"sync_dir": "~/Music",
"cookies_from_browser": "firefox",
"playlists": [
{
"name": "Daft Punk - Discovery",
"url": "https://www.youtube.com/playlist?list=PLSdoVPM5WnndSQEXRz704yQkKwx76GvPV",
"convert_to_audio": true
},
{
"name": "Minuscule Compilation",
"url": "https://www.youtube.com/playlist?list=PL7eLsxQrsg-4DNH682TNzgSlCXEeJ3IsX",
"format": "mp4"
}
]
}
Usage
$ sync-yt
Notes
-
Manual intervention is needed when a video becomes unavailable. Remove it from upstream youtube playlist to get rid of error/warning. Upon removal from upstream playlist it will be removed locally as well on next sync. So backup before syncing if needed.
-
Two different playlist can share same
nameattribute to sync both playlists in a single folder. -
You can skip installation of FFmpeg but it is highly recommended especially if you are using
convert_to_audiooption. -
metadata and thumbnail will be add to audio files only if the codec is compatible (like .mp3 or .flac)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sync_yt-1.1.0.tar.gz.
File metadata
- Download URL: sync_yt-1.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc7691d1d2054827e623a84dcede1840707e6240ac8f92112dd37b6d3d0d3d1
|
|
| MD5 |
a805f08f7007a7a026357cb476c4a865
|
|
| BLAKE2b-256 |
b7c4f67d73bdc9842badb89b59f029166da5cee9162f8e908612414ed6ed8815
|
File details
Details for the file sync_yt-1.1.0-py3-none-any.whl.
File metadata
- Download URL: sync_yt-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a00c9f7aee31527fc1ab52bb2f02e19b4e4d6e7972cba6623ec9e57265ff9310
|
|
| MD5 |
166b4304164539fef9f08a3292856fe9
|
|
| BLAKE2b-256 |
79ff5257bab6a5da6eee4750bc20c094af05b82ab146ecbf33c7c62b02a0efc7
|