Skip to main content

Delete your YouTube Music library and/or uploads

Project description

If this project helped you and you want to thank me, you can get me a beer! (I will actually use the money to buy beer, and I'll send you a virtual cheers).

ytmusic-deleter

A command-line interface for performing batch delete operations on your YouTube Music library. You can use this to remove items from both your library and from your uploads.

New in version 1.3.0, you can also sort your playlists. See the Usage information for sort-playlist.

Setup

New in 1.4.0, Windows users can download a self-contained .exe file of ytmusic-deleter without having to install Python or set up a virtual environment.

Windows Setup Using .exe File

  1. Download the latest ytmusic-deleter-<version>.exe from the Releases area in GitHub.
  2. Open a Terminal window in the same folder in which the .exe was downloaded. An easy way to do this is to open the folder in Windows Explorer, then Shift+Right-click on an empty space in the Explorer window and select "Open in Terminal" or "Open PowerShell window here".
  3. Run ytmusic-deleter by typing the name of the .exe file (you can avoid typing the full filename by just typing the first few letters and hitting the Tab key to auto-complete).

Continue See Step 4 below in "Setup (cont.)

Manual install using Python / PIP

  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.

Setup (cont.)

  1. The first time you run ytmusic-deleter, you will be asked to paste your request headers from Firefox. 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".
  2. Press Enter after pasting the headers, then press Ctrl-D to continue (Ctrl-Z then Enter again on Windows). The next time you run ytmusic-deleter, it will reuse your headers from the headers_auth.json file that it generated.

Usage

Type ytmusic-deleter to 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. Note that each track that gets added to your library this way will have a thumbs up "Like" in your library due to how the ytmusicapi works.

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.

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:

ytmusic-deleter sort-playlist "workout jams"

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.


Failed loading provided credentials. Make sure to provide a string or a file path. Reason: Expecting value: line 1 column 1 (char 0)

You will see this printed by the ytmusicapi the first time you run. This means that your existing request headers file (headers_auth.json) could not be found. The next few lines will prompt you to paste your request headers so this file can be generated.


Other various exceptions may occur while running ytmusic-deleter because there is a wide swath of possible metadata on your library, and the YouTube Music backend is changing rapidly. Most errors deleting albums have been accounted for and you may just have to delete a couple albums manually that got left behind. If there are any errors that halt the entire program in the middle of deletion, please create an Issue and post the full error.


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-1.4.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

ytmusic_deleter-1.4.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file ytmusic-deleter-1.4.1.tar.gz.

File metadata

  • Download URL: ytmusic-deleter-1.4.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ytmusic-deleter-1.4.1.tar.gz
Algorithm Hash digest
SHA256 a00ec7b611633b9db4093c154a4ec49afcd410a39a14bbd808e3e240b21c29ec
MD5 ef90126e27dbb589281a1213727dfb09
BLAKE2b-256 94f512671b12e4d135108109715fbc224e220387c5100d7b228624c2ce739361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ytmusic_deleter-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0bad041c6b43bf24703fbd37b5973b21782c64616a828da127bd456c948024a7
MD5 35299ea7ad0e71f7468541546f006a03
BLAKE2b-256 06188968557093dc3ee7726d7fa85c67a9e93f7adda079d152e4d6d1c525182a

See more details on using hashes here.

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