Importing from RSS feeds

Imagine building the website for a language center that is affiliated with multiple departments. Each department has its own news RSS feed that includes a mix of general announcements and event announcements. Different departments have different conventions for marking events. Some prefix event announcements with “Event”, some use “Events”, and some just mention the words “lecture” or “talk” in the title.

You would need to create two content types: “Departmental feed” and “Departmental event”. Leave “Departmental feed” with the default settings (Title and Body fields), and add a Link field to “Departmental event” called “Event link”. When configuring the link field, set it to have no title, and only one value.

Source data

Imagine the source data consists of RSS feeds from six different departmental sites. Each contains a mix of event and non-event announcements.

Creating the importer and basic configuration

You would create a new feeds importer by going to Structure > Feeds importers > Add importer, where you would give it a reasonable name and description.

Go to “Basic settings”. Under “Attach to content type”, choose “Departmental feed”. Set the periodic import to “Every 1 day”; a few hours’ delay between an event’s posting on the source departmental site and when it appears on the language center’s site isn’t a problem. Save.

The default fetcher (HTTP), parser (Common syndication parser) and processor (node) settings are correct for this example.

In the settings for the node processor, choose “Departmental event” under “Bundle”. Under “Update existing nodes”, choose “Do not update existing nodes”. Change the author to the site admin user. Change the “Expire nodes” setting to “6 months”, on the assumption that events are not announced more than six months in advance. After six months, the nodes created by this feed will be deleted.

Mapping

The common syndication parser, which is used for RSS feeds, has a limited number of pre-determined fields as part of the source. Not all feeds will use all these fields, but all data is stored in one of these fields. Because of this, both the sources and the targets will be presented as drop-downs. Create the following mappings:

Source

Target

Target configuration

Title

Title

Used as unique

Item URL (link)

Event link: URL

 

Description

Body

 

Feeds tamper

Title

Add the “Keyword filter” plugin. Each department has different conventions for marking events, and some don’t even mark them explicitly, just mentioning “lecture” or “talk” in the title. Because each line of the text box operates as an “or” (i.e. the keyword filter looks for the word in line 1 of the text box, OR line 2), enter each of these words on its own line within the text box:

Event

Events

lecture

talk

Importing

Go to Content > Add content > Departmental feed. Attached the feeds importer to that content type added a new field to it, “URL” under the header “Feed”. Put in the name of one of the departments, and paste in the URL of the department’s RSS feed, and save. This will fetch the RSS feed, and will create as many new “Departmental event” nodes as there are items that match the keyword filter criteria.

 

Modules: 
Tags: