pocket > ifttt > dtpro

hi there.

just discovered the great ifttt.com (if this then that) and i’m curious, if i’m able to build a clever »bookmark-workflow«? i’m using pocket right now for saving bookmarks and i want to archive them in my dtpro-database.
i don’t want to use googledocs or dropbox, but e-mail, rss or everything else would be fine. any ideas? perhaps someone has found a good solution …

best,
jan

I wrote an RSS to DT import for myself. Just set up the Pocket Feed in DT and this script will import the articles as a web archive.

set nameofDatabase to "Artikel"
set pathtoFeed to "/Pocket-Import"
set pathtoDestination to "/Artikel"

tell application id "com.devon-technologies.thinkpro2"
	
	if nameofDatabase is "" then
		set theDatabase to inbox -- the global inbox
	else
		set theDatabase to database named nameofDatabase
	end if
	
	set theTrash to the trash group of theDatabase
	
	set theFeed to get record at pathtoFeed in theDatabase
	
	set FeedEntries to the children of theFeed
	
	set i to 0
	
	repeat with thisEntry in FeedEntries
		
		set i to i + 1
		
		if i is 10 then
			exit repeat
		end if
		
		-- Use this block to get the Instapaper page
		set storeUrl to URL of thisEntry
		set theRawUrl to URL of thisEntry
		set search_string to "http://"
		set replacement_string to ""
		set AppleScript's text item delimiters to search_string
		set text_item_list to every text item of theRawUrl
		set AppleScript's text item delimiters to replacement_string
		set theRawUrl to text_item_list as string
		set theurl to "http://www.instapaper.com/text?u=http%3A%2F%2F" & theRawUrl
		
		-- Or use this line to get the full page
		--set theurl to the URL of thisEntry
		
		if the pathtoDestination is "" then
			set theDestination to incoming group of theDatabase
		else
			set theDestination to create location pathtoDestination in theDatabase
		end if
		
		set newDoc to create web document from theurl in theDestination
		set unread of newDoc to false
		--Pocket sets this to the create date of the article
		--not to the date where I added it to pocket, so it's useless :(
		--set createDate to creation date of thisEntry
		--set creation date of newDoc to createDate
		set URL of newDoc to storeUrl
		move record thisEntry to theTrash
	end repeat
	
end tell
-----------------------------------------------------------------

I’m currently putting the Pocket articles through Instapaper, therefore the limit of 10 entries for each run (Instapaper thinks my script is a bot). If you want to store the original article instead of the Instapaper version you can remove this part:

	set i to i + 1
	
	if i is 10 then
		exit repeat
	end if

(Yes, a future version might look if Instapaper is whining and will stop, instead of using 10 iterations as a fixed value).

Impressing!!! What about saving as PDF? :stuck_out_tongue:

Should also work. Just don’t create a web document :wink:.

dear truhe,

thanks a lot! really impressing and i’m quite late :wink:
i’m very sorry for that, but i did’nt received any »ping« from the server as usual?
may i ask you something anyway? i’m not familiar with applescript …
how can i setup pocket as feed or is it misunderstanding?

thank you and best regards,
jan

help.getpocket.com/customer/port … t-via-rss-

thanks a lot! this is quite cool and very helpful :slight_smile: