Import Pinboard Bookmarks to DEVONthink Pro

Thanks. It’s still not working for me, but maybe I’m using the wrong version. Is there a place I can download the latest version? Should the script run as is without further hacks? Or do I need to copy my old keychain app over from my SL instal?

I hugely appreciate your help with this. Loving Pinboard and been a Devon fan for years. Excited about making the two work together.

No, you shouldn’t need to copy something over from Snow Leopard. You can find the latest version at bugajewski.de/2011/04/import-pin … okmarks-v2

Well . . . still no dice. I get an “Import Failed” message.

Should my Keychain Access.app be launching with it? It is, and I’m wondering if I screwed something up by picking it from a pop-up window when it first ran.

Thanks again for any help.

Normally you should only see a window that lets you enter your username and password, followed by a sound when the import was successful.

It’s probably better to open the script in the AppleScript Editor and carefully watch the output.

Thanks again for your help. In the apple script editor I can see that I’m getting a log like this:

tell application "DEVONthink Pro"
	display authentication dialog "Pinboard
https://api.pinboard.in/v1/posts/all"
		--> {|password|:"xxxxx", user:"xxxxx"}
	download markup from "https://api.pinboard.in/v1/posts/all" user "xxxxx" password "xxxxx" encoding "UTF-8"
		--> ""
	display alert "DEVONthink Pro" message "Download failed." as warning
		--> error number -1708
	«event ascrgdut»
		--> error number -1708
	display alert "DEVONthink Pro" message "Download failed." as warning
		--> {button returned:"OK"}
end tell
tell application "Finder"
	exists file "Macintosh HD:System:Library:Sounds:Glass.aiff"
		--> true
	do shell script "afplay /System/Library/Sounds/Glass.aiff"
		--> error number -10004
end tell
tell current application
	do shell script "afplay /System/Library/Sounds/Glass.aiff"
		--> ""
end tell
tell application "Finder"
	display dialog "Import has finished."
		--> {button returned:"OK"}
end tell
Result:
{button returned:"OK"}

I’ve obviously removed the username and password, but I’ve checked them and they’re correct. I’ve also tested and can download my info manually from the site, so I’m not sure what else is happening.

Feel free to say “dunno, and I’m tired of helping you” and I won’t take offense.

It looks like your download fails and the routine exits with the error number -1708.

At this point I really don’t know why this is happening and (unfortunately) I can’t reproduce this with my account.

It would be interesting to see what you get in return from Pinboard. What’s the value of theXML in your case?

Do you have special chars in your password or only numbers and letters?

HOLY WOW!

Just tried a new password without special characters and it worked like a charm.

Thank you. Many times. I’m all set now.

Great that it works now. This looks like a bug in the script, but I don’t have a lot of time to fix it now. Fortunately long passwords with letters, numbers, and different case are also safe :smiling_imp:

Yep, and hopefully people having trouble with it will find this forum and discover that all they need to do is tweak their password a little and then they’re all set.

That said, if you have time, if you posted on your blog that you know about this issue, it’d probably decrease the number of knuckleheads like myself who bug you.

But again, thanks much for helping me figure this out. I’m a happy camper.

It took me very long, but I finally added the necessary information if you have a password with special characters. The solution should be to properly encode the username and password before using the API, but I don’t have enough time to add a fix.

I tried running this script (version 0.3, the latest as far as I can tell) and I got a pop-up box with this prompt:

“where is keychain scripting.app”

I’m running the latest version of think Pro Office and Lion. Any thoughts?

Thanks in advance.

The Keychain Scripting app got killed in OS X Lion. You have to either copy the older one over to Lion or download the Usable Keychain Scripting app, which should work, too.

Thanks very much for the tip!

Hi
I am trying to modify the script to include comments and creation date. Comments import just fine, but the creation date does not. I assume that DT can’t parse the date/time string exported by PB? time=“2012-02-26T17:24:39Z”

Here is the code snippet - any ideas welcome. TIA Joe

repeat with theElement in theElements
set theUrl to (value of XML attribute named “href” of theElement) as string
set theName to (value of XML attribute named “description” of theElement) as string
set theTag to (value of XML attribute named “tag” of theElement) as string
set theDate to (value of XML attribute named “time” of theElement) as string
set theComment to (value of XML attribute named “extended” of theElement) as string

					set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
					try
						set theTags to (text items of theTag)
					on error
						set theTags to {}
					end try
					set AppleScript's text item delimiters to od
					
					tell application id "com.devon-technologies.thinkpro2"
						if not (exists record with URL theUrl) then create record with {name:theName, type:bookmark, URL:theUrl, tags:theTags, creation date:theDate, comment:theComment} in theGroup
					end tell
				end repeat
			end tell

Hi all,

I’m not sure whether this would be useful for anyone else, but having used the importer for a while, I have one request: It would be great to get the descriptions/notes on links with the import. I suppose the best place would be the Spotlight comments or some other kind of metadata. Would that be useful for anyone else? Would it be easily achieved?

Thanks to all!

Mark

UPDATE: Just saw on Page 2, directly above me, something attempting this very thing. Had any luck? Thanks!

same problem. just selecting “Devonthink Pro” out of the list actually worked wonderfully.

is there a way to actually download the link and import the downloaded webarchive?

Since Lion Apple decided to abandon Keychain Scripting altogether and you have either to use a version from Snow Leopard or an alternative in order to get the current script to work (see also red-sweater.com/blog/2035/us … g-for-lion).

I’m working on a much improved version of the importer, that is not only smarter, but gives you the option to choose between web archives and simple link entries. It doesn’t depend on Keychain Scripting, but uses the command line interface and parses its output. I’m testing it since weeks and there are no issues so far. I need to wrap everything up and release an update, but I don’t have the time right now and this probably won’t change in the upcoming months.

That said, the current version works, you just have to install a Keychain Scripting app.

you sir, are the biggest tease ever… :wink:
anyways. why not throw it up on github (or just here) for now with a minimal readme. some ppl might still be able to figure it out. better than waiting for months…

it works for me, its just importing bookmarks which are not useful…

@rbugajewski Did you finish the work with the updated version?

Thanks,
Anders

It’s long ago and I haven’t tested compatibility with newer versions of DTPO. The version was basically finished and one scripting bug that affected the Pinboard script was (as far as I remember) fixed in some newer version of DTPO. The script still isn’t published and I’ve no time at the moment.