Resurfacing Old Pinboard.in Bookmarks
One day while scouring my browser bookmarks for some old forum thread I remembered that I have 9ish years worth of bookmarks in my pinboard.in account and it might be in there. While searching for that elusive forum thread I realized how many interesting and thought provoking bookmarks I’ve saved yet have never read.
I’m sure many of you can relate. Since I’ve been re-learning ruby for fun I figured this would be a great opportunity to whip up a ruby application that will send me an unread bookmark daily. By having the program send me a random bookmark daily I won’t have to deal with decision anxiety when deciding what to read.
In my infinite wisdom (heh), I assumed this would be a relatively straightforward application. Just use net/http to pull down all of my bookmarks. Then send one bookmark to my phone every morning using pushbullet. Then update the bookmark status on pinboard.in to show the bookmark as read. Simple, right? Yeah, no.
The first road block I ran into was parsing the JSON that pinboard.in returned. For some reason the response always included a byte order marker (BOM). After reading this excellent post I was able to learn all about BOMs and the JSON. I was able to handle the BOM thanks to this quick post. Apparently, I’m not the only one to run into issues with pinboard’s JSON.
After triple checking my insanity I discovered (realized?) that there is no endpoint that allows you to update a bookmark. Without this I have no way of making sure that I do not receive a duplicate bookmark one day. At least without making the application more complicated than I wanted it to be.
At this point several thoughts ran through my mind. I could abandon the project like I’ve done so many times before. Or I could come up with an entirely different approach.
And that’s exactly what I did. Instead of relying on the pinboard API to track the state of the bookmarks I decided to do everything locally. I pulled down all of my bookmarks in JSON. From there, I whipped up a small class and some utility methods that send me a daily notification through pushbullet, update the bookmark status in the JSON file, and pull down any new bookmarks since the initial bookmark export.
After going through all of this I’m thinking about building a dead simple bookmark manager. A CRUD API for managing all bookmarks. A simple and fast UI (similar to pinboard) and a small JS bookmarklet (or extension) to save new bookmarks.