DT3 RSS opening links (possibly automatically ... ?)

I have a number of RSS feeds in DEVONthink, and some of them are just really, really annoying with their summaries.

What I would LIKE to have is a way to have DT just open the link in DEVONthink when I click on the feed item. I don’t need a web archive or anything like that - but I would like to just have the item auto-open, since that’s what I have to do anyway. Click item, click link, wait for website to load, read article.

I realize that’s probably not an option, but that would be the ultimate solution if it could be done.

As an alternative, I’d like to just be able to press a couple of keys and have it open the URL in DEVONthink. I can use the control-command-O, but that launches the link in my default browser - which isn’t what I want to do.

And honestly, if the default link behavior were just to open links in DEVONthink, I’d be happy with that.

Is any of that possible?

Is the item’s link in the feed item link metadata? (Does that question make sense?)

If so, I imagine you could use a smart rule to convert the items to bookmarks as they roll in.

Actually, it makes a lot of sense. :slight_smile:

I checked at least a couple of the feeds, and they all have link metadata.

I have a very rudimentary rule in place now that can detect the new feed items. Right now it’s just duplicating them to my inbox (to test whether it worked).

As for the finalizing of the rule, I’m not seeing any way to convert them to bookmarks - only HTML, web archives, etc. I’m pretty sure it’s possible, but I have no idea how.

Any idea how that would be accomplished?

Hmm. I misremembered bookmarks as being available as a convert action, sorry. Scripting it is:

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with eachRecord in theRecords
			set theURL to eachRecord's URL
			set theDestination to get record with uuid "insert-destination-group-UUID"
			set newRecord to create record with {type:bookmark, URL:theURL} in theDestination
		end repeat
	end tell
end performSmartRule
1 Like

@ryanjamurphy - That works really well - extremely useful.

Thanks

Question - let’s suppose I use this to convert multiple RRS feeds into a combined “RSS Bookmarks” group. Any idea on how I can adjust the script to at the name of the feed (or even better a nickname I choose) as a custom metadata item?

1 Like

Custom metadata would be easy. After the set newRecord ... line, you could just get the data you want to use in the metadata column and add it using a set newRecord's custom meta data ... command (that might not be exactly it—writing that from memory).

1 Like

OK - I see here in the Dictionary - I will play with this to get the syntax right - thanks

1 Like
on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with eachRecord in theRecords
			set theName to eachRecord's name
			set curParent to (parent 1 of eachRecord)
			set curParentName to curParent's name
			set theNewName to "[" & curParentName & "]" & " - " & theName
			set theURL to eachRecord's URL
			set theDestination to get record with uuid "D6DB704A-2C06-41CC-8A58-5799D334C772"
			set newRecord to create record with {name:theNewName, type:bookmark, URL:theURL} in theDestination
		end repeat
	end tell
end performSmartRule

Here’s what I have so far. This converts each RSS item to a [feedname] - [itemtitle] format, and dumps everything in a folder. Which is cool. And I suppose that instead of naming, I could do meta tagging with the feed name.

But as DT3 doesn’t seem to allow multi-sort (i.e. by meta tag and then by date), it would be nice to be able to have each of the feeds wind up in their own folders, just like it is now.

Is that even remotely possible to do for a hundred or more feeds without a ton of “look up the group ID, code an exception” sort of stuff?

I’d be happy to just make a new item right in the same location, but it seems that you can’t create an item in an RSS group (which makes a lot of sense technically).

1 Like

Yeah, for sure! You’d have to script the dynamic naming of groups, but it should be pretty easy. Set theGroup to create new record with properties {name: some-variable, type: group}.

Okay…I think I have this sorted out.

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with eachRecord in theRecords
			set theName to eachRecord's name
			set curParent to (parent 1 of eachRecord)
			set curParentName to curParent's name
			set theNewName to "[" & curParentName & "]" & " - " & theName
			set theURL to eachRecord's URL
		set theDestination to (get record at "/@ Articles")
			if not (exists record at "/@ Articles/" & curParentName) then
				set theGroup to create record with {name:curParentName, type:group} in theDestination
			else
				set theGroup to (get record at "/@ Articles/" & curParentName)
			end if
			set newRecord to create record with {name:theNewName, type:bookmark, URL:theURL} in theGroup
			add custom meta data curParentName for "RSSSource" to newRecord
		end repeat
	end tell
end performSmartRule

Basically, it grabs the parent name of each item in an RSS feed (each RSS item should only have one parent, by its nature), checks to see if the folder “@ Articles” already has the feed name as a folder, and if not, creates one. Then the article gets written, tagged with the name of the feed.

The only real issue I can foresee would be if two feeds legitimately had the same name - then they’d both land in the same folder. But I think I’m okay with that. :slight_smile:

Trying to tag @rkaplan in case this is helpful code.

And if there’s anything glaringly obvious that I’m missing, corrections are always appreciated. :smiley:

Thanks Ryan!

1 Like

Hm. A slight tangent, but this might be a useful way to actually create useful offline files for the kinds of sites that offer useless summary data in RSS.

Once the bookmark is created, it should be possible to convert it into a webarchive, HTML, or even PDF file containing the item’s actual content, rather than the summary. It’d involve a bit of work, though—I just tried it on an academic journal and the result included all the mess of the site’s sidebars, banners, footers, and so on. But there might be something there…

1 Like

Thank you - this looks very interesting - I will try it out this weekend.

I agree separating them into groups is very helpful for academic research. But when I am just combining general news feeds it is helpful to combine them together in one group with a tag to identify them. Looks like the examples here allow for both options.

Question - what are you using to trigger the smart rule? I am experimenting with “On News” and “On Save” and “On Import” in the RSS group and I am not sure I quite have it right with any of those.

@ryanjamurphy - Is there a way to tweak that Script so that the “Name” field appears in the standard system font rather than the hyperlink font used as a default with bookmarks?

This is how the records are listed as an RSS feed - this is fairly easy to read:

This is how the records are listed a bookmarks - not as easy to read:

Preferences -> General -> Appearance -> “Highlight links in views” will disable the blue/underline across the whole app. Oddly, it doesn’t seem to make it exactly the same font as the regular list views (mine is less bold) - but the blue goes away.

I almost can’t imagine that it would be possible to specify the display font for a link on a per-item basis.

1 Like

That works - thanks
And the way to get the full bold back is to add to the script to mark the item as unread:

image

1 Like

Ah, that makes sense. :slight_smile:

Thanks!

This looks very useful! How can it be done in DT2?

I don’t recall DT2 having Smart Rules, so you’d have to run the script yourself manually or via a scheduler such as a cronjob or Keyboard Maestro. You’d also have to modify how the script selects which items to act on, perhaps via creating a smart group and targeting only the items in it.

Upgrading to DT3 is probably easier! :sweat_smile:

1 Like

I feel like the scripting should be almost identical. Go grab a random RSS feed, add it to DT, and try the script. :slight_smile:

Keyboard Maestro is awesome for this sort of thing.

DEVONthink 2.x indeed did not have smart rules.

And we would definitely advocate moving to DEVONthink 3.

1 Like