Jump to content

Pinboard 1.53 (Alfred 4): Search, Add and Delete Bookmarks


Recommended Posts

Alfred 4

 

Read about the workflow below.

 

Here is an update for Alfred 4: DOWNLOAD

 

NOTE: Right now the workflow does not support URLs with "#" in it.

 

Overview

Pinboard workflow is a front end for Pinboard that allows you:

  • search
  • filter by tags
  • add public bookmarks
  • add private bookmarks
  • set a new bookmark as To Read
  • delete a bookmark
  • get the selected text as the bookmark description (see Syntax)
  • interact with: Safari, Google Chrome, Google Chrome Canary, Chromium, Webkit and Firefox

First Run
 

Before running the workflow you need to set your Pinboard API Token:

 

To get it go to your Pinboard account and copy the API in Settings>Password.

To enter it open Alfred Preferences>Workflows then select Pinboard then, finally, click in Configure Workflow and Variables (as seen below):

 

workflow_preferences.png

Usage


If you need help show Alfred and type the keyword phelp

Search

Search will always look for URL, title, description and tags.

Basic search

  • show Alfred and type the keyword ps
  • type your query e.g. ps apple

Filtering by tags

  • show Alfred and type the keyword ps
  • type a hash sign and select a tag from the list (autocomplete) e.g. ps #tag1 #tag2 :
  • after the colon type your query e.g. ps #tag1 #tag2 :apple

Actions

  • return key: open the bookmark
  • option key: delete the bookmark (you may need to manually reload the local cache)

Add

Public, Private and To Read Bookmarks

The workflow will list always two options:

  • Add Public Bookmark to Pinboard
  • Add Private Bookmark to Pinboard

Holding Command key will add it as an unread bookmark.

Note: make sure your Browser is the front most window then use the keyword pa

Note: Firefox may need that you reload the page. Anyway, the workflow always show the URL so you can check if it is right or not.

Last Used

The workflow also saves the last command (Last Used item) so you can easily replicate. And with a hotkey you can add a bookmark even without any interaction at all.


Syntax

You can optionally add tags and a custom description.

To add tags simply type a hash sign and select it from the list (autocomplete) e.g. pa #tag1 #tag2 :

After the colon, as seen above, you can optionally type the bookmark description e.g. pa #tag1 #tag2 :great workflow

And in order to get the selected text as the bookmark description type enclosed brackets after the colon e.g. pa [] or pa #tag1 #tag2 :[]

To add just a description just type it after the keyword e.g. pa great workflow


Hotkeys

Search, Add and Last Used have also a hotkey that you can set in Alfred Preferences.


Local Bookmark Cache

In order to make things a bit faster, the workflow caches all your Pinboard bookmarks and tags.

However, due even Pinboard API limitations the workflow will not, for now at least, update the cache automatically.

However, if your cache is more than one day older the workflow will let you know.

Anyway, you can use the keyword preload to manually update the local cache.

Finally, the workflow has an external trigger so you can update the local cache from other application or script. Just use the code below:
 

tell application "Alfred 3"
	run trigger "reload" in workflow "com.sztoltz.pinboard" with argument ""
end tell

Download

 

Version 1.5 for Alfred 3
Release date: 08 Jul 2016
Requires Alfred 3
macOS 10.11.5

 

 

What’s New in Version 1.5 (08 Jul 2016)?

 

- Fixed the add new bookmark bug

 

What’s New in Version 1.4 (27 Jun 2016)?

 

- Moved workflow setting to Alfred Preferences

- Updated Help (keyword phelp)

- NOTE: you have to enter your Pinboard API token again

 

What’s New in Version 1.3 (08 Jun 2016)?

 

- Alfred 3 support

 

 

What’s New in Version 1.2 (05 Oct 2014)?

 

- Yosemite support

 

What’s New in Version 1.1 (29 May 2014)?

 

- Fixed a description parsing bug thanks to Vítor

Edited by Carlos-Sz
Link to comment

This looks great, Carlos-Sz, I would’ve expected nothing less. I’ve been putting off improving my own pinboard workflow, and after seeing yours, I’m not sure I’ll even bother. I like a lot of the ideas here.

I’m wondering though, as amazing as it is what you can do with AppleScript, my question is “why?”. Not questioning your preference, but it is an unusual choice for building so many so complex things, so I’m interested as to the reason you always use it as the language in your workflows.

Going back to the workflow itself, it’s having trouble getting my bookmarks. It’s getting stuck on one of them. Here’s the debugging info

[ERROR: alfred.workflow.action.script] Code 1: 0:45: execution error: Can’t get text item 2 of "<post href=\"http://worrydream.com/MediaForThinkingTheUnthinkable/note.html\" time=\"2013-06-20T16:06:38Z\" description=\"An Ill-Advised Personal Note about "Media for Thinking the Unthinkable"\" extended=\"Related to the “Media for Thinking the Unthinkable” talk by Bret Victor.". (-1728)

After running some tests, it seems the problem is connected to multi-line descriptions. The full description for that bookmark should be (including line breaks)

Related to the “Media for Thinking the Unthinkable” talk by Bret Victor.

“Right now, today, we can't see the thing, at all, that's going to be the most important 100 years from now”.

As you can see, the workflow is seeing it truncated. If I edit the bookmark to remove those lines, it works.

Link to comment

This looks great, Carlos-Sz, I would’ve expected nothing less. I’ve been putting off improving my own pinboard workflow, and after seeing yours, I’m not sure I’ll even bother. I like a lot of the ideas here.

I’m wondering though, as amazing as it is what you can do with AppleScript, my question is “why?”. Not questioning your preference, but it is an unusual choice for building so many so complex things, so I’m interested as to the reason you always use it as the language in your workflows.

...

 

Thank you for finding the bug. It’s fixed. Link.

 

Why Applescript? Maybe because it was the first language I played with when I started using a Mac. ;)

Link to comment
  • 2 weeks later...

This is looking really good so far.

 

Quick question though: do you know how to remove an entry from the results? In my specific example, Alfred wants to show Printers & Scanners. And it's a tiny bit annoying.

 

3R5tMl0.png

 

Any help is appreciated!

 

Edit: Sorry for the huge screenshot!

Edited by JamesMowery
Link to comment

Carlos-Sz — I have a feature request (whose difficulty will depend on the implementation of the workflow). A Hotkey trigger to add a link as unread. Now, this is certainly doable in its current incarnation, but it is slow. When I add a bookmark as unread, usually I want to add it and close the tab I’m on, as fast as possible. For this reason, in PinAdd, the section that takes care of this action has its own logic implemented (in the sense that it specifically calls only the needed parts to be as fast as possible).

It can be summarised in three steps:

  • Get the browser’s frontmost tab’s url and title.
  • Show a notification saying the bookmark was successfully added.
  • Send the API request to add it.

Notice how the notification itself is shown as soon as possible as a way of informing “you may close the tab now” (it’s irrelevant to the user if the request is already complete or not, specially since I catch possible errors). Having a specific logic for this action also makes it blazing fast — I can pretty much press the hotkey and close the tab. With yours, however, it takes a while to show the notification (and since I want to close the tab right away, that extra second really drags on), and if I close it too soon, it adds the wrong one (the tab “behind it”, which is now the frontmost one).

I hope the request makes sense, and that you consider adding it.

JamesMowery — I think that option is not currently available. I think it would be a welcome addition, so a feature request is worth considering. I found a link through Google that seems like it was addressing this very question in these forums, but is now dead.

Link to comment

JamesMowery — I think that option is not currently available. I think it would be a welcome addition, so a feature request is worth considering. I found a link through Google that seems like it was addressing this very question in these forums, but is now dead.

 

No worries! I was just curious if there was a known way to do so that I was missing. I hope they add something like that.

 

Regardless, it took me a few days, but I'm currently using your workflow exclusively for navigating and adding Pinboard links on my Mac. Thanks a million for that! :)

 

If there would be one suggestion, it would be to slightly tweak the way of adding the description from highlighted text:

 

I'd recommend that — instead of having to type brackets, which are somewhat challenging to hit accurately all the time (I accidentally hit 'p' quite a bit, particularly in the dark, and especially when trying to do it as quick as possible with Alfred to maximize time saved) — you type two single quote marks ('') instead. It's faster to type (at least in my opinion), it's immediately accessible to the right of your pinky finger, it's less movement of your fingers, it makes sense logically, as you are, in some respect, 'quoting' the content you selected on the page, and it's not something you'd accidentally type.

 

Or, if you wanted to get even faster, use the backtick key ( ` )to the left of the "1", which, as I have just learned via Wikipedia, represents substitution in programming terms. Makes sense!

 

Edit: Only issue with the backtick key is that it's close to escape, and it's also a bit of a challenge to find if you're in a hurry and not used to hitting it (which I am not). Given that, I'd stick to recommending the single quotes key.

 

And, again, awesome work! :)

Edited by JamesMowery
Link to comment

When considering special characters as being “easier to type”, don’t forget keyboard layouts are different internationally. Your points do not apply to mine, for example. The idea of quotes does make sense, though (logically).

Link to comment

This is looking really good so far.

 

Quick question though: do you know how to remove an entry from the results? In my specific example, Alfred wants to show Printers & Scanners. And it's a tiny bit annoying.

 

...

 

Any help is appreciated!

 

Edit: Sorry for the huge screenshot!

 

 

I think that after a space after the keyword ps the printer preference will be removed from the list.

 

Anyway, you can remove OSX preferences from Alfred altogether: Alfred Preferences > Features > Default Results

 

Carlos-Sz — I have a feature request (whose difficulty will depend on the implementation of the workflow). A Hotkey trigger to add a link as unread. Now, this is certainly doable in its current incarnation, but it is slow. When I add a bookmark as unread, usually I want to add it and close the tab I’m on, as fast as possible. For this reason, in PinAdd, the section that takes care of this action has its own logic implemented (in the sense that it specifically calls only the needed parts to be as fast as possible).

It can be summarised in three steps:

  • Get the browser’s frontmost tab’s url and title.
  • Show a notification saying the bookmark was successfully added.
  • Send the API request to add it.

Notice how the notification itself is shown as soon as possible as a way of informing “you may close the tab now” (it’s irrelevant to the user if the request is already complete or not, specially since I catch possible errors). Having a specific logic for this action also makes it blazing fast — I can pretty much press the hotkey and close the tab. With yours, however, it takes a while to show the notification (and since I want to close the tab right away, that extra second really drags on), and if I close it too soon, it adds the wrong one (the tab “behind it”, which is now the frontmost one).

I hope the request makes sense, and that you consider adding it.

...

 

I got the idea but if something goes wrong then the notification will be misleading unless I kind of copy some of your ideas and cache errors. :)

 

No worries! I was just curious if there was a known way to do so that I was missing. I hope they add something like that.

 

Regardless, it took me a few days, but I'm currently using your workflow exclusively for navigating and adding Pinboard links on my Mac. Thanks a million for that! :)

 

If there would be one suggestion, it would be to slightly tweak the way of adding the description from highlighted text:

 

I'd recommend that — instead of having to type brackets, which are somewhat challenging to hit accurately all the time (I accidentally hit 'p' quite a bit, particularly in the dark, and especially when trying to do it as quick as possible with Alfred to maximize time saved) — you type two single quote marks ('') instead. It's faster to type (at least in my opinion), it's immediately accessible to the right of your pinky finger, it's less movement of your fingers, it makes sense logically, as you are, in some respect, 'quoting' the content you selected on the page, and it's not something you'd accidentally type.

 

Or, if you wanted to get even faster, use the backtick key ( ` )to the left of the "1", which, as I have just learned via Wikipedia, represents substitution in programming terms. Makes sense!

 

Edit: Only issue with the backtick key is that it's close to escape, and it's also a bit of a challenge to find if you're in a hurry and not used to hitting it (which I am not). Given that, I'd stick to recommending the single quotes key.

 

And, again, awesome work! :)

 

I’ll see what I can do about it.

 

Right now I’m thinking in a way to automate the process: if there is a selected text then the description will be added. No need to type anything in Alfred.

Link to comment
  • 3 months later...

How long does it typically take for the cache to be created after entering the API key? It's been over an hour and ps still asks for the API key. 1774 pinboard bookmarks. Also, I am running up to date Yosemite.

 

Looks great though, thanks for sharing it!

 

Landon

Edited by landon
Link to comment

How long does it typically take for the cache to be created after entering the API key? It's been over an hour and ps still asks for the API key. 1774 pinboard bookmarks. Also, I am running up to date Yosemite.

 

Looks great though, thanks for sharing it!

 

Landon

 

Version 1.2 should work on Yosemite now. Please, let me know.

 

Download

Link to comment

Great workflow - thanks for that. One request - would it be possible to add the details of the Pinboard description field in the returned results? If I have a number of websites around a similar area I usually know which one I'm looking for by little notes I put in the description field.

 

Either way, thanks again for a great workflow.

Link to comment

Carlos-Sz, 

 

Sorry, took 2 days for me to get to this but installed and works great. Thanks for the quick response, especially given Yosemite isn't even released yet!

 

Landon

 

Gerat! Thank you for your feedback.

 

 

Great workflow - thanks for that. One request - would it be possible to add the details of the Pinboard description field in the returned results? If I have a number of websites around a similar area I usually know which one I'm looking for by little notes I put in the description field.

 

Either way, thanks again for a great workflow.

 

The workflow will also search in description though it does not display it.

 

If you really need to always read the description then it is something I’ll have to think about it due the Alfred interface.

Link to comment
  • 2 weeks later...

Hi Carlos,

 

I've just installed the 1.2 extension in Yosemite but adding tags does not work for me. They do not autocomplete and if I add any then the bookmark is added with no description or tags.

 

I can add just a description to a bookmark without issue.

 

Any ideas?

 

Best,
 
Alex
Link to comment

Sometimes, pa fails for me. I get "Pinboard Error. Try it later." Running on yosemite, Safari and trying to bookmark a https site. Any suggestions to help debug? I didn't see anything useful in the Alfred debug output or console.

 

I’ll have to investigate the issue though it may happen even with a http link.

 

 

Hi Carlos,

 

I've just installed the 1.2 extension in Yosemite but adding tags does not work for me. They do not autocomplete and if I add any then the bookmark is added with no description or tags.

 

I can add just a description to a bookmark without issue.

 

Any ideas?

 

Best,
 
Alex

 

 

Try to delete the workflow then install it again.

 

It will need some time to download bookmarks and tags.

 

Anyway, as soon as possible I’ll make some tests.

Link to comment
  • 5 months later...
  • 5 months later...

Hi Carlos:

 

I've been using your evernote workflow, and i love it so much! Next is to use this alfred-pinboard workflow and here's what i observed:

 

In pinboard.in website, i have something like this:

 

"breedingCatsDomain.com" has the following tags: "cats" "breeding"

"breedingDogsDomain.com" has the following tags: "dogs" "breeding"

 

SEARCH COMPARISON (pinboard.in VS alfred workflow):

 

I. In pinboard.in website:

 

if you query tags "/t:breeding" it shows all.

 

... That would have lots of articles and would be better if its narrowed down by filtering another tag. eg.

 

if you query tags "/t:dogs/t:breeding" it shows "breedingDogsDomain.com" only

if you query tags "/t:cats/t:breeding/" it shows "breedingCatsDomain.com" only

 

II. In alfred-pinboard workflow:

 

ps #breeding it shows all (--same results--)

ps #dogs #breeding it shows all (breedingDogsDomain and breedingCatsDomain.com) (--different results--)

ps #cats #breeding it shows all (breedingDogsDomain and breedingCatsDomain.com) (--different results--)

 

i could use "#dogs" but that would be difficult to search about breeding if it has several articles about dogs.

 

Any idea what i need to do to narrow down results by adding tags? (same as how you did in evernote workflow).

 

 

- Jayson

Edited by webjey
Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...