TIP: Import from Pinboard Bookmark Service

I decided to phase out my use of the Pinboard bookmarking service, and am now just keeping those bookmarks in Drafts (go figure!) using the share extension/capture tools.

I did not want to lose my history, so I created an action to import my history into Drafts from a Pinboard backup file.

If this is something you might do, I suggest reviewing the action - particularly you might want to modify the “template” variable in the first script step to alter the format of the imported drafts.

To use this action:

  • Go to Pinboard, click on “settings”, then “backup”
  • Download a JSON format backup of your pins.
  • Place the downloaded file in your iCloud Drive/Drafts folder, and rename it “pinboard_export.json”
  • Install the Import Pinboard Backup action.
  • Run it…the action will:
    • Read the import file, and make sure it can be parsed and is valid.
    • Prompt you letting you know how many pins will be imported
    • Ask for an optional additional tag to assign, which defaults to “pinboard”. Any tags you assigned in Pinboard will also be assigned as drafts tags, but this additional tag can be used to identify the imported items later.
    • Choose whether you want the new drafts in the inbox or archive (archive is default).
    • After prompt, the action will create a new draft, using the template configured in the action, for each pin in the backup. The draft will contain the title, description, url, any assigned tags, and the creation date of the draft will match the original timestamp of the pin.

That’s pretty much it. Feel free to tweak to your particular needs. Get the action:

1 Like

If you are looking for a service to replace Pinboard.in I can highly recommend Anybox: https://anybox.app/

To confirm, “not just keeping” = “now just keeping”, right? Had a few seconds of thinking “so what are you using now, Greg?” before I parsed the sentence properly… :slight_smile:

Fixed. I’m a typo waiting to happen.

Just to clarify, does it create ONE Draft ‘doc’ with all the bookmarks in it? Or one Draft ‘doc’ for each individual link/bookmark? My list of bookmarks in Pinboard is pretty insanely long, as this dates back to the days of Delicious.

@agiletortoise - thankyou - worked perfectly - once I read the instructions properly (sorry - male).

@sgclark - to answer that - it creates one draft per link - so I now have a LOT of drafts in my drafts archive - which is OK - and what I expected. Now I want to export those across to an obsidian vault. BUT. I only have actions that do that one at a time.

Wondering if there is a solution/action to bulk export the drafts to files in a folder - which I can then move into obsidian?

Many thanks in anticipation.

1 Like

@Fractals Thanks for clarifying.

Yeah, it appears I have around ~5K bookmarks in my Pinboard account :face_with_spiral_eyes: so importing all of them into Drafts would be a unmitigated disaster for me :rofl: …not sure what I would do with them right now. And on top of that, I did a quick scan of those Pinboard bookmarks, and most of them are ancient, broken, and/or woefully useless and out of date, so maybe its time to just do a hard reset of my whole Pinboard account.

each is tagged with ‘pinboard’ - so once I crack the bus management - it will be fine.

without a doubt not needed - given that my newest book mark is November 2021 - Raindrop is my new space - which is also getting into a bit of a mess,

You have a few choice for mass-export. Actions can be written (or shortcuts) that work on queries for drafts, but if you have an action configured to work the way you want on one draft, you can use “Run Action” via operations (gear icon below draft list) to run that on all selected drafts (tap and hold on “Select” to select all).

That might get a little weird if you are selecting thousands of drafts, but test on some and see how that works for you.

Thankyou - ‘TIL’ that you can run one action on multiple drafts - WOW - tried it - and it works - BUT sadly won’t solve this problem … I will continue to noodle.

The action “Post to Obsidian (no YAML)” cannot be run as a batch operation on multiple drafts. It contains URL action steps which may leave the app and not return to allow the operation to be continued. This action must be run on only one draft at a time.

Looks like you want to switch out the URL ‘posting’ for writing direct to a file. I wrote about this recently in case it helps.

1 Like

Did you write down how you’ve setup the “pinboard” system in Drafts? I can imagine the parts of it, having a separate workspace, tags and actions. But I’m a fairly new user and this is exactly something I’d like to setup for myself. Thanks in advance!

I don’t have a super formal pinning system or any special related actions. I tag pins “web” (+ any topic-specific tags), and generally capture them either via the Share extension in Safari, or via a bookmarklet through Web Capture.

I mostly use it for keeping up with things I want to read later, and leave the captured sites in the inbox until a re-visit them to read and then file them in the archive with any notes/impressions about the article I want to remember.

1 Like

BRILLIANT - thankyou so much - downloaded the action and worked like a charm. I can see the entries all nicely organized in the appropriate folder.

I did notice that the tags are imported - BUT - not recognized as tags. The export directly to Obsidian makes the tags ‘active’ - is there a tweak I can make to your action that would allow for the same.

Looking at it closely, my normal obsidian export - takes something like

Tags: tag1 tag2 tag3

and creates #tag1 #tag2 and #tag3

when I use the export to file you shared it creates

tag1 tag2 and tag3

how do I ensure the hashtag is added?

Side Note

Drafts did crash in the middle of the export - but as @agiletortoise mentioned earlier - behavior might not be ‘consistent’ for ‘large numbers of drafts’ - that is ok, I will simply export subsets - it will work - just making sure it is flagged for others that might try this.

To add an octothorpe in front of each Pinboard tag, then this is the line you would need to modify in the original action (look in the second script step).

let tags = item['tags'].split(" ").map(x => x.trim())

The map is saying for every x (tag in the array of tags), trim any whitespace from the front and end).

You can prefix each tag with the octothorpe by extending what the map is doing:

let tags = item['tags'].split(" ").map(x => "#" + x.trim())

Here’s a standalone example you can put into a separate action and try out. It will just display the result of processing the demo item defined at the start of the script. I’ve added comments so you can hopefully follow what is going on

// This section is creating an example 'item' that might have been exported by Pinboard
// It is just for demo purposes, and really, only the 'tags' property is of note in regards to what we want to do.
let item={};
item.href="https://directory.getdrafts.com/a/2Fd";
item.description="Import Pinboard Backup";
item.tags="action pinboard drafts";
item.extended="N/A";

// This next commented out line is in the action (second script step)
// let tags = item['tags'].split(" ").map(x => x.trim())
// Here's what to replace that line with in the action
let tags = item['tags'].split(" ").map(x => "#" + x.trim())

// This just displays the tags in a list - one on each line
alert(tags.join("\n"));

In the action, this block of code adds the Pinboard tags to the draft.

for (let tag of tags) {
	if (tag.length > 0) {
		d.addTag(tag)
	}					
}

Assuming you modified the line of code in the action to add the octothorpe, with every element in the tags array having now been prefixed, these prefixed tags will be added to the new draft for the Pinboard item when it is created in Drafts.

When the drafts are then exported to files in your Obsidian vault, assuming the action you are using is subsequently reading the tags from the draft and including them in the file, Obsidian will then recognise them as tags.

Just as a side note, the Obsidian export could potentially have been modified insetad in a similar fashion to prefix the tags with an octothorpe.

You could maybe consider searching for a tag to filter your list down to do the batch exports to Obsidian.

Regarding the crashing, it would be interesting to know if you were using URL-based or direct file creation in the way the notes were being created in Obsidian, as well as what sort of volumes and what platform (iOS/iPadOS/macOS) you were using. I’ve not done mass exports, so I’ve never encountered this, but it might be a useful benchmark for anyone looking at mass exports, and roughly sizing their batching.