Export item URLs

The Problem

Clipping articles from Medium.com is sketchy at best. Often, all I get in the body of the note is the HTTP redirect message “302 Found”.

However, I’m able to get the text from these articles using a Node package called “medium-to-markdown-enhanced” - all I need is the article’s URL. I’m more than happy writing my own external script for this (I prefer using Ruby) but I don’t see how I can quickly export URLs for the 100 articles in DEVONthink Pro Office.

The Question

How can I export the URLs of all files in a directory, preferably to a single file?

I would prefer avoiding having to write/use AppleScript, and my Bash scripting skills are limited at best. But I’m open to any ideas anyone might have. Or is there perhaps something built in I’ve overlooked?

Many thanks!

Here’s a simple approach that exports the URL of selected files if the URLs begin with “http”…

-- Export URLs of Selection to Text File
-- Created by Jim Neumann / BLUEFROG on Sun Jan 20 2019.
-- Copyright (c) 2018 BLUEFROG / DEVONtechnologies, LLC. All rights reserved.

tell application id "DNtp"
	set urlList to {}
	repeat with thisRecord in (selection as list)
		if (URL of thisRecord begins with "http") then
			copy (URL of thisRecord & return) to end of urlList
		end if
	end repeat
	if urlList ≠ {} then
		do shell script "echo " & (quoted form of (urlList as string)) & " > ~/Desktop/urllist.txt"
	end if
end tell
1 Like

Worked great!

Glad to hear it. Cheers! :smiley: