Skip to main content

Easily delete your YouTube Music library

Project description

ytmusic-deleter: Delete your YouTube Music library

GitHub Downloads (all assets, all releases)
PyPI - Downloads
GitHub Release
Release test
Release test
Pytest
Codecov
Discord

This is the command-line interface for ytmusic-deleter. For the graphical Windows .exe edition, visit the main page

Command-line interface install using Python / PIP

The CLI version of ytmusic-deleter is for advanced users who would rather use a command-line or are running macOS.

For the graphical Windows .exe edition (or Linux), visit the main page

Installation instructions of this command-line interface:

  1. Install Python. Make sure it is available on your PATH.
  2. Open a command prompt and type pip install ytmusic-deleter. Use a virtual environment if you're familiar with the process.
  3. Run ytmusic-deleter by simply entering ytmusic-deleter at the command line.

Authentication (Browser)

The first time you run ytmusic-deleter, you will be asked to paste your request headers from your browser. This allows ytmusic-deleter to make requests against your music library. To copy your request headers follow the instructions from the ytmusicapi docs under "Copy authentication headers".

$ ytmusic-deleter whoami
[2024-11-16 12:51:05] Attempting authentication with: C:\Users\<username>\AppData\Roaming\YTMusic_Deleter\browser.json
[2024-11-16 12:51:05] Creating file: browser.json
Please paste the request headers from Firefox and press 'Enter, Ctrl-Z, Enter' to continue:

If you are running macOS, please see the special pasting instructions in the "MacOS special pasting instructions" section of the ytmusicapi docs.

Usage

When you run ytmusic-deleter with no parameters, you will see see the usage information. There are several commands available.

delete-uploads:    Delete all tracks that you have uploaded to your YT Music library.

Use the --add-to-library or -a option to add each album or song to your library from YouTube Music's online catalog before deleting it from your uploads. If a match could not be found, the album or song will remain in your uploads. When using the -a option, you can also enable fuzzy matching with --fuzzy or -f. This is a less strict matching algorithm that will find more matches, but may find inaccurrate matches in its current experimental state. Use the --score-cutoff or -s option to raise or lower the default matching score cutoff of 90. A value closer to 100 will be more strict, and a value closer to 0 will be less strict.

remove-library:    Remove all tracks that you have added to your library from within YouTube Music.

unlike-all:    Reset all Thumbs Up ratings back to neutral.

delete-playlists:    Delete all manually created YT Music playlists.

delete-all:    Combo command that will run delete-uploads, remove-library, unlike-all, and delete-playlists.

Non-deletion commands:

sort-playlist:    Sort a playlist alphabetically by artist and then by song title.

Use the --shuffle or -s option to shuffle the playlist instead of sorting it.
Use --custom-sort or -c to define custom sort parameters Available parameters are: artist, album_title, track_title, and duration. See below for examples.
Use --reverse to reverse the sort order.

remove-duplicates:    Remove duplicate tracks from a particular playlist.

Use the --exact or -e option to only remove exact duplicates. This will skip the portion that checks for duplicates that are similar matches but not the same exact track.

add-all-to-playlist:    Add all library songs or uploads to a particular playlist.

Examples

Getting help:

ytmusic-deleter --help

This will print the usage information for ytmusic-deleter and exit.
You can use the --help argument to print usage information for subcommands as well, as follows:

ytmusic-deleter delete-uploads --help

Delete all your uploads:

ytmusic-deleter delete-uploads

Delete all your uploads but add them to your YouTube Music library first:

ytmusic-deleter delete-uploads -a

Remove all your library tracks (not uploads):

ytmusic-deleter remove-library

Reset all Thumbs Up ratings back to neutral:

ytmusic-deleter unlike-all

Delete all your personally created playlists:

ytmusic-deleter delete-playlists

Remove everything (uploads, library tracks, playlists, and unlike all songs):

ytmusic-deleter delete-all

Sort a playlist called Workout Jams using the default settings (sorts by artist then album title):

ytmusic-deleter sort-playlist "workout jams"

Sort a playlist using custom sorting attributes (attributes are applied in order):

ytmusic-deleter sort-playlist "workout jams" --custom-sort artist --custom-sort album_title --custom-sort track_title

Remove duplicate tracks from a playlist called "Focus"

ytmusic-deleter remove-duplicates focus

Add all uploads to a playlist called "All my uploads"

ytmusic-deleter add-all-to-playlist "All my uploads" --uploads

Extra options

These supplemental options are unlikely to be helpful for most use cases and are mainly to support the GUI version.

Options:
  --version                  Show the version and exit.
  -l, --log-dir TEXT         Custom directory in which to write log files,
                             instead of current working directory.
  -c, --credential-dir TEXT  Custom directory in which to locate/create JSON
                             credential file, instead of current working
                             directory
  -p, --static-progress      Log the progress statically instead of an
                             animated progress bar

Troubleshooting

ytmusic-deleter: command not found

or

'ytmusic-deleter' is not recognized as an internal or external command,
operable program or batch file.

Make sure you ran pip install ytmusic-deleter to install ytmusic-deleter. If you're still getting this error, try closing and re-opening your command prompt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytmusic_deleter-2.9.0.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

ytmusic_deleter-2.9.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file ytmusic_deleter-2.9.0.tar.gz.

File metadata

  • Download URL: ytmusic_deleter-2.9.0.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ytmusic_deleter-2.9.0.tar.gz
Algorithm Hash digest
SHA256 57daef4200e4db4649edc6c214e9c46dccc37dc7ffae4b3d24223efdcb396b88
MD5 2f3b7f62bef76078ae7dd4b89cad1e71
BLAKE2b-256 72f9851e9954ef7f05ea50f7ccda776f7075f17c6dfd5911e1633b1898094434

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytmusic_deleter-2.9.0.tar.gz:

Publisher: release.yml on apastel/ytmusic-deleter

Attestations:

File details

Details for the file ytmusic_deleter-2.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ytmusic_deleter-2.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73ca36bfe7bf9c5b5234b1b038bef67233e6d8af0b8d1ed30e60f04cb1ecd9e2
MD5 96b575bf4cfc007326c041dd76de2c07
BLAKE2b-256 ed7ae231fd8813080f468b42f0a43e655c1ae59ab89b73f76fbd53548d2c76c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ytmusic_deleter-2.9.0-py3-none-any.whl:

Publisher: release.yml on apastel/ytmusic-deleter

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page