listenbrainz / elbisaur
This page has not been reviewed by our documentation team (more info).
elbisaur is a (beta) Deno command line application to access the ListenBrainz API. It supports ListenBrainz submission and various other tools, e.g. listen deletion.
For more information visit the elbisaur site and documentation:
https://github.com/kellnerd/elbisaur
How-to: Delete a time range of ListenBrainz listens
- Install Deno from https://deno.com/ (runtime which can execute JavaScript and TypeScript programs). With that installed, you can directly run scripts from the internet using their URL. Sounds dangerous, but Deno is a sandbox system which asks for permissions to read/write resources by default. Check that you have successfully installed Deno, by executing
deno --version
in a terminal (e.g. in the 'Command Prompt' program in Windows). - Install elbisaur with the following command:
deno install --global --allow-env=LB_USER,LB_TOKEN,ELBISAUR_LISTEN_TEMPLATE --allow-net=jsr.io,api.listenbrainz.org,musicbrainz.org --allow-read --allow-write jsr:@kellnerd/elbisaur
It looks more complex than it really is because of all the permission arguments. - Try executing
elbisaur
it should show the help... and complain about a missing LB_TOKEN. - Get your token from https://listenbrainz.org/settings/
- Create a text file called
.env
in a empty folder, where you will be storing the list of listens for deletion. In that text file write a single line,LB_TOKEN = xxx
(xxx is your token from step 4). - In your terminal, navigate to that folder (example command for navigating to a folder:
cd Admin\ListenBrainz
). - Run
elbisaur
again, it should find the token and complain no more. - Run
elbisaur history
to show your most recent listens. - The next step is to download (and thus backup) the list of listens that we are going to delete. We will specify the time range of these listens. The command will be something like
elbisaur history --user username --after "2024-01-23 12:34:56" --before "2024-01-24 12:34" --count 200
We need the time of the first and the last bad listen (in your timezone). And count, if you are deleting a lot of listens - the API only returns 25 by default. Modify and run the command until the results contain all the listens you want to delete. - Then, run the command again but append
--output bad_listens.jsonl
to store the list in a file. - Now you have a backup (because you can always re-submit any listens from that list/file) and we can pull out the delete command. It only deletes listens from a file, so you can't accidentally delete listens for which you don't have a backup. The command to preview the deletes is
elbisaur delete --preview bad_listens.jsonl
- Removing
--preview
will run it for real, which takes a while as the API requires one request per delete and is rate-limited. Run it when you are ready, and then check the website for results. You may have to wait until the full hour before the deleted listens finally disappear from ListenBrainz.