One of the most common uses of Yahoo Pipes is to mashup several RSS feeds and perform a few operations on them, such as sorting by date or filtering for keywords. This is a relatively easy Pipe to build, and you have many options for filtering and/or sorting, depending on your needs. Before you continue reading this tutorial, please read up on basic Yahoo Pipes functionality.
Sample Yahoo Pipe Details
In the sample Pipe for this tutorial, we'll mash together the RSS feeds of two blogs, Performancing and Blog Herald, sort reverse chronologically by date, then truncate the resulting RSS "stream" at 20 items.Basic Yahoo Pipe Building Process
Let's go over a basic "feed mashup" example, then discuss variations. The most basic feed mashup is to simply supply two or more RSS feed URLs in a Yahoo Pipe. (For simplicity, let's start with a static list of feeds.) But that's not useful since you don't know how items in the resulting "stream" are ordered. So let's sort the mashed up feed in reverse chronological order (newest to oldest). The process is as follows:- Supply two or more RSS feed URLs.
- Fetch the feeds.
- Combine the feeds together.
- Sort them in reverse chronological order.
- Truncate the mashed feed to 20 items.
- Output the resulting stream as an RSS feed
Yahoo Pipes Modules to Use
That is the most basic process, and to produce an actual Yahoo Pipe, we need to use only 4 modules, in the following order:- Fetch Feed. Specify one or more feeds, grab their items, and combine them into a single feed. Notes:
- This Pipes module is found under the Sources sub-menu.
- Assume resulting item ordering is undefined.
- In our example, shown below, we'll use the Performancing and Blog Herald RSS feeds.
- Sort. Specify a sorting field and criteria. In this case, sort by Publication Date (item.pubDate) in descending order. Notes:
- This module is found under the Operators sub-menu.
- In the past, Pipes' Sort module has not always worked consistently, but we are at its mercy.
- Truncate. Take the mashed stream and truncate it after X items. Notes:
- This module is found under the Operators sub-menu.
- We're limiting the result to 20 items.
- Output. Output the mashed stream. This will be available from the standard Yahoo Pipes "run" interface. From there, you can retrieve the dynamic RSS feed URL for the output stream. Note:
- This module is automatically displayed in a new Pipe, once you drag and drop any other module.
Basic Pipe Variations
There are a number of simple variations that you can apply to the above sample Pipe that are relatively easy to do.- Sort in chronological order (oldest article first).
- Filter by date. E.g., articles newer than a certain day.
- User-supplied date filter. Pick the maximum
- User-supplied truncation limit. So instead of hard-coding "20" as the number of items in the mashed feed, let the end user of the Pipe supply the value.
- User-supplied URLs. You are limited to a fixed number of URLs that can be specified.
Advanced Pipe Variations
Here are some more advanced variations for our feed mashup Pipe.- Remove extraneous data fields in input streams. If you look at the results of the example Pipe, you'll see more than just the item description and title. One of the input feeds has extra links thanks to its Feedburner settings. If you don't want them appearing in the result, you have to filter these fields out before the two feeds are mashed together.
- Truncate the number of items used on a per feed basis rather than on the entire mashed feed. E.g., the 5 most recent items for each feed.
- Use a dynamic external list of feed URLs. The best way to do this is to build Pipe #1 to process a single feed: sort reverse chronologically and truncate to X items (hard-coded or user-supplied). Then build Pipe #2 to read an external list of feed URLs and loop through each, supplying each stream to Pipe #1, then mashing up the results of all streams.
Requests for Custom Pipe
Obviously, I cannot provide example Pipes for each variation listed above, but what I will do is two things:- Take suggestions for an advanced Pipe as described above, create it, then either share it in the comments here or cover it in the next Yahoo Pipes By Example post. So I'll build a free custom Pipe, provided it's not too complex, can be done in a few hours, and is generic enough that it'll be useful to someone other than yourself. (I can only work on it on weekends.)
- Progressively include other Pipes modules in hard exampes.
Raj Dash's blog