############################################# # Title: Get RSS feeds links and convert to Markdown ############################################## # Iain Dunn # Logic2Design # www.logic2design.com # logic2design@icloud.com # Last update: 16 January 2022 # Version: 2 ############################################## # Configuration ############################################## set RSSfeed to "http://rss.cnn.com/rss/edition.rss" -- rss feed that you want to process set RSSarticles to 3 -- number of items you want displayed ############################################## # Code ############################################## set RSSfeed to do shell script "curl -s " & quoted form of RSSfeed without altering line endings tell application "System Events" set RSSfeed to make new XML data with properties {text:RSSfeed, id:0, name:"untitled"} set RSSRecords to {} repeat with xmlElement in (XML elements of XML element "channel" of XML element "rss" of RSSfeed whose name is "item") set end of RSSRecords to {RSSTitle:value of XML element "title" of xmlElement, RSSLink:value of XML element "link" of xmlElement} end repeat end tell set theRSS to "" set limit to RSSarticles set counter to 0 repeat with a from 1 to the number of RSSRecords set counter to counter + 1 if (counter > limit) then exit repeat set theArticle to item a of RSSRecords set RSSTitle to RSSTitle of theArticle set RSSLink to RSSLink of theArticle --set theRSS to theRSS & "" & RSSTitle & "" & return -- URL set the theRSS to theRSS & "[" & RSSTitle & "](" & RSSLink & ")" & return -- MD end repeat set the clipboard to theRSS display dialog theRSS -- for testing purposes remove if not required