RSS News Feed Filtering with RAW

April 28, 2022
Posted by Georges Lagardère

RSS still feeds the news

We read here and there that RSS is dead – launched 20 years ago but it’s still around. The New York Times, Wikipedia or CNN are still pushing news over their RSS feeds.

RSS is also used for other topics like Food Safety Information; the US government provides a mashup of different sources into one single feed for product recalls and other alerts. This page has a RSS Feed Link

In this post we will show how easy it is to search for terms over this feed. If you click the link above, you will see a RSS format like the following :

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="" version="2.0">
    <title>Food Safety</title>
    <description>An RSS feed of combined Food Safety information.</description>
    <atom:link href="" rel="self" type="application/rss+xml" />
    <category>Health Marketing</category>
      <title>FSIS Issues Public Health Alert for Ground Beef Products  Due to Possible E. coli O26 Contamination</title>
      <description>WASHINGTON April 27, 2022, - The U.S. Department of Agriculture's Food Safety and Inspection Service (FSIS) is issuing a public health alert due to concerns that specific ground beef products...
      <guid isPermaLink="true"></guid>
      <pubDate>Wed, 27 Apr 2022 12:00:00 EST</pubDate>
      <category>Food Safety</category>


Using RAW to process news data

RAW can read and process XML, just like JSON, and has support for relational and log file structures too. You can read more about how we handle structures in our docs.

From a RAW perspective, this structure above is composed of an item, which is a collection, and within lies a channel record – so the data structure looks like this:

`item`: collection(
                    record( `title`: string,
                            `description`: string,
                            `link`: string,
                            `guid`: record( `@isPermaLink`: bool,
                                            `#text`: collection(string) ),
                            `pubDate`: string,
                            `category`: string ) 

We are interested in filtering the title to search for certain terms which could be brands or product names for instance. This can be achieved via a RAW Query function below called feed, which extracts the title, publication date and link for any title containing the search term passed to the function :

feed(search:string) := {
    title, pubDate, link 
  WHERE LOWER(title) LIKE CONCAT("%",LOWER(search),"%")

In this RSS structure, remember that channel is a record and item is a collection of records, so by writing channel.item in the READ() the SELECT statement is operating over that collection as if it were a table in standard SQL.

Calling feed("Ferrero") at the time of writing this post now returns :

	"title": "Ferrero Voluntarily Recalls Kinder® Happy Moments Chocolate Assortment and Kinder® Mix Chocolate Treats Basket Because of Possible Health Risk and Advises Consumers to Dispose of Certain Kinder Products Not Intended for U.S. Distribution Due to Recall of Products Made in Belgium",
	"pubDate": "Tue, 12 Apr 2022 00:00:00 EST",
	"link": ""

Creating an API

As you can see, it is simple to create a function to filter data from an RSS feed.

To turn this into a reusable API endpoint, you can follow this development guide. It’s very simple and will take a few minutes. Once the endpoint available you can call it from any application to monitor this RSS feed for specific topics.

At RAW Labs, we are currently building a feature to make this even easier to use, including simple scheduling of jobs: for instance it will be possible to call the endpoint at regular times, e.g. every day to check for alerts or updates.

In the event of an RSS returning a result, it will be possible to send an email, a text message or a Slack notification by the use of another API call. This will be shown in another post as soon as the feature is released, stay tuned !

For more information, get in touch with us today.

Georges Lagardere Sales Director RAW Labs

Georges Lagardère, VP Customer Experience, RAW Labs.

Want to learn more?

Learn More


Tutorial 1. First flight with RAW

First Tutorial with RAW where we take reader through a first query, first API and passing parameters to that API


Analysing the News with RAW

Use RAW with Web APIs to produce powerful analysis results on web pages. This example shows analysing web pages in RSS feeds, using metadata extraction and Google's language entity extraction.


816,000 interesting FREE datasets with RAW Labs

Free Datasets are a great resource - see an example showing how to use RAW to query, transform and join with other data, then expose API endpoints for further data sharing.