How Do I Create a Notification for an RSS Feed?

I'd like to monitor updates to sites, and have e.g., a notification when a new post is uploaded.

I took an initial pass, by pushing the text of an RSS feed into a text variable, but I'm stuck now. I guess I'd need to somehow parse the latest post, and compare it to a previous variable?

Sorry for the lack of abilities here, I searched the forums and only found a couple posts but people went to other tools it seems like. I would use IFTTT in the past for this, but they've moved to a gross subscriber model and broke all my previous integrations so I want to go to a paid, local-only solution.

Thanks !

Is there any side documentation on here for text parsing?

Hey @kmaestro,

Welcome to the forum!  :smile:

Your task is not a simple one, and it will be difficult to help you without a specific example feed.

-Chris

1 Like

There are a great number of text-parsing examples on the forum, but there is no formal documentation for using KM to parse text.

-Chris

1 Like

Ah thanks, and thank you for the welcome ! I will search for the examples of parsing text on the forum, and update the post once I do.

Your task is not a simple one, and it will be difficult to help you without a specific example feed.

I'm trying to parse this feed, if that helps any: Turbo charge your Mac with the best productivity tool in the market

Question, what is your goal?

And, as an alternative, tried NetNewsWire, Inoreader or any other RSS app?

NetNewsWire can display an unread counter in the app icon

My goal is to do different automations based on the RSS feed content. To start, was looking to get an unread notification for specific feed based on specific text I'm interested in (something NetNewsReader & a couple other RSS feed readers didn't seem to handle).

Next, I plan to look at the specific text & trigger other actions, like e.g., open a webbrowser & display a website.

Hey @kmaestro,

This sort of job is not pretty, so hang on to your hat and get ready for a steep learning curve.

I installed the xml2 command line tool using MacPorts (Homebrew has it as well).

The command looks like this:

curl -sL --user-agent 'Opera/9.70 (Linux ppc64 ; U; en) Presto/2.2.1' https://old.reddit.com/r/keyboardmaestro.rss | xml2

You have to download the feed with curl, wget, or another tool for downloading website text.

Curl is installed by default on macOS, but it's usually an old version – so I use MacPorts to keep mine up to date.

The downloaded text is piped to xml2, and the result looks like this:

/feed/@xmlns=http://www.w3.org/2005/Atom
/feed/@xmlns:media=http://search.yahoo.com/mrss/
/feed/category/@term=KeyboardMaestro
/feed/category/@label=r/KeyboardMaestro
/feed/updated=2021-01-06T02:19:28+00:00
/feed/icon=https://www.redditstatic.com/icon.png/
/feed/id=/r/keyboardmaestro.rss
...

Which is much more conducive to text parsing than XML, unless you have a really good tool for working directly with XML and the knowledge to use it.

Once you have the tools set up they're not too hard to use from Keyboard Maestro.

This macro uses curl and xml2.

xml2 must be installed by the user manually or via MacPorts or Homebrew.

Parse RSS Feed XML ⇢ Curl Command Line Tool v1.00.kmmacros (5.6 KB)

This macro uses the Keyboard Maestro native Get a URL action to siphon the feed text from the web, which is then piped to xml1.

Parse RSS Feed XML ⇢ KM Native Download v1.00.kmmacros (6.3 KB)

Now that you have the feed text you can parse it to your heart's content.

Keyboard Maestro's Search using Regular Expression action may be used, or you can employ more tools in the shell script.

This is about as far as I'll go on this topic, but I will answer questions.

-Chris

2 Likes

Hi @ccstone/Chris, thank you so much! This gets me exactly to where I need and opens up a lot of possibilities. That was extremely helpful!

I'm in my trial of KeyboardMaestro, but now that I know it can meet this use case will be making a purchase.

Best,

km

2 Likes