Question

I am trying to create a workflow that converts a list of URLs into plain text using Instapaper, and then saves the text in text documents on my machine.

So far, I have been able to grab the list of URLs, convert them, and save text documents. The problem is that I can't figure out how to use the name of each web page as the name of the subsequent document.

I use my Instapaper RSS URL to grab the articles. Then I use "Get Link URLs from Articles" followed by an Applescript to convert to the plain text version. "Get Text from Webpage" grabs the text. "New Text File" allows me to save each document, but they all have the same name, the one I entered into the Save As input in the New Text File action.

How might I have that action save the documents as each webpage's title?

Was it helpful?

Solution

If you pass this AppleScript a URL it should return the title of the page...

on run {input, parameters}
    set pageTitle to do shell script "curl " & quoted form of (first item of input) & " | grep -o \\<title\\>.*\\</title\\> | sed -E 's/<\\/?title>//g'"
    return pageTitle
end run
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top