Bash one-liner to get unsubmitted HN articles from your Wallabag favorites
If you want to know which of your favorite Wallabag (self hostable application for saving web pages) articles haven't been submitted yet to HN, you can do so with a one-liner command. After exporting your favorites to JSON from the Wallabag Web UI, do:
``` for url in $(jq -r '.[].url' Downloads/Starred\ articles.json); do \ curl -s "https://hn.algolia.com/api/v1/search?query=$url&restrictSearchableAttributes=url&analytics=false&typoTolerance=false" \ | jq -r .nbHits | grep -q ^0$ && echo $url; done | tee /tmp/unpublished ```
This is easily adaptable to other use cases. The tricky part was figuring out the query parameters for Algolia search API.
Previous threads about Wallabag:
https://news.ycombinator.com/item?id=14686882 https://news.ycombinator.com/item?id=30421036