Trigger script - help requested! Trying to cache RSS...

Hi all,

I’m poking my way through a script that should - were it to work - pull down Markdown versions of items in an RSS feed. It’s everyone’s holy grail, the cached copy of your Instapaper feed - though I’d imaging a (working) version of this script would find all manner of uses.

The code is:


on triggered(theTriggeredItem)
	tell application id "com.devon-technologies.thinkpro2"
		set theSelection to (children of theTriggeredItem)
		if theSelection is not {} then
			try
				repeat with theRecord in theSelection
					set theURL to the URL of theRecord
					set theName to the name of theRecord
					if theURL begins with "http:" or theURL begins with "https:" then
						if label of theRecord is not 7 then
							set theGroup to parent 1 of theRecord
							set theCopy to create Markdown from theURL
							-- set creation date of theCopy to creation date of theRecord
							set the name of theCopy to the theName
							-- set the label of theCopy to label of theRecord
							-- set the state of theCopy to state of theRecord
							set the tags of theCopy to tags of theRecord
							--	set creation date of theCopy to creation date of theRecord
							--	set modification date of theCopy to modification date of theRecord
							set the label of theCopy to label of theRecord
							set the label of theRecord to 7
						end if
					end if
				end repeat
			on error error_message number error_number
				if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
			end try
		end if
	end tell
end triggered

The error I get from DEVONthink is

This is the name of one of the items in my Instapaper RSS feed, an article from The Guardian.

(I’m using label 7 as ‘archive’, so I can skip over pre-archived items in the feed).

Any smarter people with suggestions, critiques, or better still - fixes - welcome to join in the fray!

TIA

Dave

What is showing in the Replies?

Hi Jim!

Well, the first few come through, until it hits an article at The Guardian - then the whole thing just stops. I’m not sure how to get more useful debugging information out of the script, as I’m not Applescript-savvy enough to work that out (despite your advocacy :slight_smile: ) - though the HTML page behind the HTTPS link in the RSS item definitely has a title (I use a subset of this script to capture bookmarks and turn them into Markdown pages locally)

I could paste the raw RSS… it’s sat in my clipboard (manager history)…

Dave

Try hardcoding the URL in a small script like this. Does it fail?

tell application id "DNtp"
	set theCopy to create Markdown from "http://someURL.com" in current group
end tell

Hi Jim,

Yes, it fails -

tell application id "DNtp"
	set theCopy to create Markdown from "http://www.theguardian.com/world/2017/aug/29/hong-kong-coffin-homes-horror-my-week" in current group
end tell

Run from Script Editor.app, I get

“missing value”

though I have no idea what’s triggering that. Are there useful ways to debug this kind of thing?

This seems to be a site-specific Markdown issue, I’ll forward this.

Our decluttering service should now be able to cope with the redirections The Guardian is using.