cleanABag, a tool to remove old articles from wallabag

Thursday, November 10, 2022

wallabagclidev

Since I started working on walgot1, a TUI client for wallabag2, I started thinking about “cleaning” articles from wallabag to avoid wasting storage (and make walgot even faster to load at the same time).

In truth, 99% of the articles, once read, don’t need to stay on wallabag. Articles I want to bookmark are moved to a bookmarks.org file. But there are exception, and I’m using the “star” status in wallabag to keep some articles longer. Sometime, I just used the star as well as a reminder that I want to share it with friends (specially when behind paywall, I need to generate a public link and the mobile app doesn’t allow this).

Anyway, long story short, looking at more than 1000s articles on my wallabag, the web UI didn’t help me do what I wanted quickly. My main use case is simple: I want to delete articles older than a special date, but keeping the starred and unread ones.

So I coded a very quick and dirty little tool called cleanABag, where one can simply give a date and delete all articles older than this date (with flags for keeping/removing unread and/or starred articles).

For example, to remove articles not updated since the end of 2021, including unread (-u) and starred (-s):

cleanABag prune -c /path/to/config -d "2021-12-31" -u -s

Nota: The command above will only do a “dry run” and won’t delete anything except if --delete is added.

Because of the way I use wallabag, I don’t remove stuff frequently, so having a tool to remove thing older than, for example, a year, deleting only archived and not starred articles, quickly is a nice way of not wasting storage (or bandwidth with remote client like mobile app or walgot).

The code is available on source hut and the readme should be self sufficient:

cleanABag repository

Let me know if you have any comment on feedback.


Contact

If you find any issue or have any question about this article, feel free to reach out to me via email, mastodon, matrix or even IRC, see the About Me page for details.

See Also

Walgot v0.2.0

Announcing walgot, a Wallabag TUI client