The Union Module can merge up to five separate feeds into one feed.
In this Yahoo Pipes example, lets take a look at the news feeds for the MLB, NFL, NHL and NBA and merge them all into one feed.
If we want to simply merge all these feeds together without performing any extra actions on them, we can simply enter them all into the Fetch Feed Module like so:
But if we want to perform different actions on each feed, then “unionize them”, we can use the Union Module. Lets take each feed and perform a minor action on each one (we’ll use a few different modules that we’ve already covered).
First, lets put each of our feeds in their own Fetch Feed Module.
This is our most complicated Yahoo Pipe so far, but if it looks confusing – it’s really not. All we’ve done is connect each feed to a different module to perform different actions on each one.
We can connect the MLB feed to the Reverse Module (to reverse the order of our feed items)
We can connect the NHL feed to the Filter Module to only allow articles where the description contains the word “Crosby”. (This will only allow articles about Sidney Crosby.
We can connect the NFL feed to the Truncate Module to limit the feed to first 5 items.
And we can connect the NBA feed to the Tail Module to get the last 10 items.
Now we can connect all of our sources to the Union Module to combine them.
Now we’ve performed different actions on our MLB, NFL, NHL and NBA feeds and merged them into one giant feed with the Union Module.