Script Sunday: Fixing a Self-Inflicted Pinboard Nuisance
I really like the recent-ish share sheets in iOS, but I learned to my dismay that sometimes you’re not really sure what you’re passing from one app to another. After a week of using the RSS reader Unread in combination with the Pinboard app Pinner to save bookmarks, I learned that Unread was sending Pinner the domains of the things I was saving as the description, and not the title. So instead of a list of bookmarks that looked like this:
- Reading in the dark
- Archive articles from various sources to org file via IFTTT and Dropbox : orgmode
- 9 Tips For Black And White Street Photography Post Production
- How to Culture Jam a Populist in Four Easy Steps | Caracas Chronicles
- E unibus pluram: television and U.S. fiction. - Free Online Library
- The first days inside Trump’s White House: Fury, tumult and a reboot - The Washington Post
I ended up with a list of bookmarks that looked like this:
- metafilter.com
- reddit.com
- lightstalking.com
- caracaschronicles.com
- thefreelibrary.com
- washingtonpost.com
To be clear, this is a self-created problem brought about by my habit of saving anything that looks vaguely interesting and refusing to use the version of the Pinner share sheet that would have let me review title and tags before saving them. I’m okay with this, because the alternative is trying to peck in a description on my iPad while I’m hanging on to a strap on the Max.
Anyhow, there’s a gem for Pinboard that lets you run through your bookmarks and do stuff with them. Well ... it lets you run through your bookmarks and learn stuff about them, and allows you to use the Pinboard API action to create a “new” bookmark. If you re-save a URL you had previously bookmarked, it’ll update the original item with anything that changed.
There’s probably also a way to programmatically determine whether a given string is a valid domain, but I went cheap and just check to see if the end of the description string is something like:
\.ab\.abc\.abcd\.abcde
(plus a few other possibilities I’m willing to live with, since I’ve spent more time describing this than I did writing it)
Anyhow, the whole thing is short, simple, and dumb as a rock:
<script src="https://gist\.github\.com/pdxmph/3c822098420e30db600300ca4006f17d\.js"></script>I’ve got a version sitting in my /bin directory that talks to the Alexa Web Information Service and extracts the categories for a given URL, but there’s some interesting taxonomical noise I need to sort through before I’ll actually use it in anger: Categories in Alexa seem to be a mix of topics (e.g. “photography”) and formats (e.g. “blog”). The former would be a great thing to programmatically tag a hastily saved bookmark with, the latter wouldn’t.
Probably also worth noting that Unread isn’t so much better than Reeder that it was worth having to run this thing every so often, so I switched back to Reeder, which does what I’d expect and passes a proper title to begin with.
#pinboard #ruby