sync-yt
sync-yt is a command-line tool that keeps YouTube Music playlists mirrored to local directories on your system. It downloads tracks with yt-dlp, tags them, and tracks sync state in a local SQLite database so that changes made upstream and changes you make locally are both handled correctly.
Note: As of v2.0.0, sync-yt is an audio-only tool. Video playlist syncing was removed in favour of becoming a focused music library manager. If you need video downloads, use
yt-dlpdirectly or stay on v1.x.
Features
- Declarative
config.yamlto specify playlists and options. - Three-way sync between YouTube, your local folder, and a state database.
- Embeds metadata and cover art into audio files when the codec supports it.
- Can sync private playlists by pulling cookies from your logged-in browser.
- Detects tracks that have become unavailable upstream.
- Automatically skips duplicate entries within a playlist.
Requirements
Make sure both Node.js and FFmpeg are in your PATH.
FFmpeg is required in v2.x, since every download is passed through audio extraction. Node.js is used by yt-dlp for JavaScript challenge solving.
Installation
-
Windows
$ pip install sync-yt -
Arch Linux
sync-ytis available on the AUR. Use your favourite AUR helper.$ yay -S sync-yt -
Other Linux Distributions / macOS
Since
sync-ytrequires a latest version ofyt-dlp, which may not be available in your OS's official repositories, usingpipxis recommended.$ pipx ensurepath $ pipx install sync-yt
Configuration
The configuration file is searched for in this order:
~/.config/sync-yt/config.yamlon POSIX systems, orC:\Users\<User>\AppData\Local\sync-yt\config.yamlon Windows../config.yamlin the current working directory.
If neither exists, sync-yt exits with an error.
sync_dir
- Type:
string: required - Description: The local directory where playlist folders are created. May be an
absolute path or use
~for your home directory. The directory must already exist; sync-yt will not create it for you. - Examples:
~/Music,D:\Music
cookies_from_browser
- Type:
string: optional - Description: The browser to extract cookies from. Required for playlists that are only accessible while signed into a Google account. Omit it if you only sync public playlists.
- Examples:
firefox,chrome,brave,edge,vivaldi
playlists
-
Type:
list: a list of playlist entries, each with the following keys:-
name: required- Type:
string - Description: A name for the playlist. This is also the name of the folder created
inside
sync_dirwhere the playlist is synced. A playlist with a missingnameis skipped with an error.
- Type:
-
url: required- Type:
string - Description: The URL of the YouTube playlist. Must contain a
list=query parameter, which is used as the playlist's identity in the state database. A playlist with a missingurlis skipped with an error. - Example:
https://www.youtube.com/playlist?list=PLSdoVPM5WnndSQEXRz704yQkKwx76GvPV
- Type:
-
format: optional- Type:
string - Description: The audio codec to convert to. Defaults to
best, which keeps the best available source audio without re-encoding. - Supported values:
best,aac,alac,flac,m4a,mp3,opus,vorbis,wav - Example:
mp3
- Type:
-
Example configuration
sync_dir: ~/Music
cookies_from_browser: firefox
playlists:
- name: Daft Punk - Discovery
url: https://www.youtube.com/playlist?list=PLSdoVPM5WnndSQEXRz704yQkKwx76GvPV
format: mp3
# Keep source quality, no re-encode
- name: Liked Songs
url: https://www.youtube.com/playlist?list=LM
Usage
$ sync-yt
Every playlist in the config is synced in order. Progress, warnings, and errors are written to the console.
How syncing works
sync-yt compares three sources on every run:
- Upstream: the current contents of the YouTube playlist.
- Local: the files currently present in the playlist's folder.
- Database: the last known synced state, stored in
.sync_yt.dbinsidesync_dir.
Based on this comparison, sync-yt downloads/removes local items to match the upstream playlist.
Downloaded files are named <title> [<video id>].<ext>. The video ID in the filename is how
sync-yt recognises its own files, so renaming files will cause them to be treated as
untracked and their tracks to be re-downloaded on the next sync.
The database is created automatically on first run and migrated forward as needed.
Notes
- Manual intervention is needed when a track becomes unavailable upstream. Remove it from the YouTube playlist to clear the warning. Once removed upstream, it is deleted locally on the next sync. Back up first if you want to keep the file.
- Metadata is embedded for
mp3,m4a,flac,opus, andogg. - Cover art is embedded for
mp3,mka,m4a,flac,opusandogg.
License
MIT see LICENSE.
Metadata
Release files for sync-yt 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sync_yt-2.0.0.tar.gz | 12.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sync_yt-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.4 kB
Release files / sync_yt-2.0.0.tar.gz
| Download URL | sync_yt-2.0.0.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2116bb62c818f9b33976ea793d5584e4fea364f8210a1875cb9e27504af9d541
|
|
BLAKE2b-256 checksum How to use checksums |
7c07802f94aa10881fccd0b9c08b133c0a9e6cecf73d91737b1563ef5753ee0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / sync_yt-2.0.0-py3-none-any.whl
| Download URL | sync_yt-2.0.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8ab47e95ad6fc8858447026295d631b9928719319fc8f1fd5ee777b5bb5bb91
|
|
BLAKE2b-256 checksum How to use checksums |
42422bf0a7e05a3c88445882bc22ca1e7e5e364cd0646eacf69c229dd2641de9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|