Little helper for cleaning up broken bookmarks in Readeck.
Find a file
2025-06-02 17:25:51 +02:00
delete-empty.sh add delete-empty.sh 2025-06-02 17:06:08 +02:00
LICENSE.txt initial commit 2025-05-30 19:58:39 +02:00
readeck-cleanup.sh make deletion of re-submitted bookmarks optional 2025-06-02 17:25:51 +02:00
README.md make deletion of re-submitted bookmarks optional 2025-06-02 17:25:51 +02:00

readeck-cleanup

Little helpers for cleaning up broken bookmarks in Readeck.

DISCLAIMER: THESE SCRIPTS DELETE BOOKMARKS! THEY'RE MADE AS A QUICK AND DIRTY HACK AND MAY HAVE BUGS AND DELETE BROOKMARKS YOU WANT TO KEEP. USE AT YOUR OWN RISK!

If you just imported your bookmarks from Pocket or somewhere else, there's a good chance that a lot of the original articles don't exist anymore or that Readeck fails to retrieve the article contents for various reasons, leaving you with a bunch of broken bookmarks. These scripts try to help clean them up.

Requirements:

  • curl
  • jq
  • an API token (generate one at your.instance/profile/tokens)
  • export READECK_API_TOKEN='your token'
  • export READECK_BASE_URL='https://your.instance/'

readeck-cleanup.sh

  • fetch broken bookmarks (has_errors=true)
  • check if the URL still works, i.e. can be fetched with curl
  • if it does, create a new bookmark to force Readeck to retry retrieving its contents (bookmark gets label __cleanup)
  • if the website doesn't work anymore, delete the bookmark
  • if saving the URL as a new bookmark succeeded, delete the old one
  • in consecutive runs, checks if bookmarks with label __cleanup are still broken and deletes them

Usage: ./readeck-cleanup [<limit> [DELETE_RESAVED]]

Example: ./readeck-cleanup 25 DELETE_RESAVED

The first argument is a limit of how many bookmarks to process in one go. The default is 1. The maximum is 100 due to some API limitation/bug, so you'll likely have to run it several times. The script adds the label __cleanup to all bookmarks it creates so it doesn't re-save the same bookmarks over and over. When you're finished with the cleanup, you can easily remove that label from all remaining bookmarks at once via the web interface.

If there's a second argument DELETE_RESAVED, the script will check for bookmarks it previously re-submitted with label __cleanup and delete them for good if they're still broken (has_errors=true).

delete-empty.sh

Usage: ./delete-empty.sh <API query> [DELETE]

Example: ./delete-empty.sh site=berliner-zeitung.de DELETE

Searches bookmarks without content (i.e. where reading time is missing or 0) and optionally deletes them. This can be useful for bookmarks where Readeck couldn't extract any useful content but didn't flag the bookmark with has_errors=true. Often happens when articles don't exist anymore but the news sites redirect to their start page instead of returning a 404, so Readeck extracts a few menu items or whatever. However for some websites Readeck simply fails to extract the article content even though they're still there, so use with caution, limit the search using the query argument and review the results before activating deletion.

The first argument is simply added as is to the API query URL and allows you to narrow down the results. You can find the documentation of all query parameters at your.instance/docs/api#get-/bookmarks. If there's a second argument DELETE the found bookmarks will be deleted, otherwise their IDs and URLs will be printed without further action.

The script processes only up 100 bookmarks at a time, so you might need to run it multiple times.