More Pipes Pseudo Branching

I wanted to play around some more with the fake branching I was doing with putting domains in titles (or not). I wanted to try and imitate something a litte more substantial than just playing around with text fields – so I decided to see how I could make a pipe that returned either a yahoo search or a flickr search depending on what was asked for.

My pipe that I used to test this is here and I’ll talk about this technique using it as my example.

It turns out that this kind of branching is pretty easy to do. The basic trick is this – you do both searches in the Pipe and you tag them with a special string that includes the name of the search (in this case either “yahoo” or “flickr”). You use the Regex module to modify the title and then at the same time you use another regex rule to *remove* the special tag and the name from the title that was passed in. So you start out substituting:


at the end of the title for all yahoo search results. Then, if the user is asking for yahoo results you the remove the string “-==nevahmatch==-yahoo”. This then removes the string you just added leaving the title exactly as it was. In the case where the user asked for flickr results what you would have been looking for was the string “-==nevahmatch==-flickr” which would not have matched and would have left the wierd string in the title.

So, now, in this case we now have two rss feeds coming in, one from yahoo and one from flickr. One with the title untouched and one with a wierd string appended to the end of all the titles. So we can run them through a union and then run that output through the second step of our if statement – a filter. The filter will block anything with the string “-==nevahmatch==-” in the title, this will completely remove one of the feeds leaving only the requested feed as output.

The trick is quite simple but somewhat involved. It’s not as good as a true branching module because it makes yahoo do a lot more work since it has to actually fetch two feeds and process each of them with several regex rules. But, this should open up some more possibilities in Pipes until they do!

blog comments powered by Disqus

Not Found

Sorry, but what you are looking for isn't here...