The extraction mechanism used in #6 has ended up being quite generic rather than being overly specialised towards snippets.
It searches a feed, then fetches content based on the link there.
So, we could quite conceivably make this support searching snippets, recipes and my blog based on the binary name in the command line (allowing us to do some busybox like magic)
Activity
27-Sep-24 13:36
assigned to @btasker
27-Sep-24 13:57
mentioned in commit 97444fd9c97cbbd09b436d0006cee4cf0a5292ef
Message
feat: search different sites based on the binary name (utilities/snippets_cli_go#8)
27-Sep-24 13:59
The names introduced by ^ aren't set in stone, I just wanted to establish the structure.
Currently:
btcli
: search www.bentasker.co.uk (note: feed only contains a limited number of items)rbt_cli
: search recipebook.bentasker.co.ukWe'll ultimately want to add one for snippets, but I can't do that until the site's migrated. In the meantime, though, support for the others means we can continue development.
27-Sep-24 15:00
mentioned in issue #1
29-Sep-24 11:44
The way that this works is relatively simple.
The utility looks up the command line that it was called with (allowing it get search terms as well as the name that it was called by).
At the top of the code is the definition of
searchDestinations
:It looks for the program name in that map. If it finds it, it'll use those settings - otherwise it'll fall back to the default:
The attributes
parseTitle
andextraCol
were introduced in #12. IfparseTitle
is true and the page title (as listed in the RSS feed) ends in the form(something)
it'll extract the text between those brackets and add an extra column to search results, usingextraCol
as the column title.