Developing with Yahoo! Pipes

Philip S Tellis

Yahoo! Inc

Linux Symposium 2008

Do you like Unix Pipes?

Do you deal with web services?

Have you ever wished that you could pass the output of multiple web services through a unix pipe?

VoilĂ : pipes.yahoo.com

VoilĂ : pipes.yahoo.com
(You need a Yahoo! Id)

Nomenclature

Part I: Creating Pipes using the UI

1A simple feed aggregator

1A simple feed aggregator

Let Pipes figure out the feed URL

1A simple feed aggregator

Let Pipes figure out the feed URL
(use the Fetch Site Feed source)

1A simple feed aggregator

limit it to 5 items only

1A simple feed aggregator

limit it to 5 items only
(use Truncate)

1A simple feed aggregator

Limit it to only 2 items per feed

1A (not so) simple feed aggregator

Limit it to items that do not contain FreeBSD

1A (not so) simple feed aggregator

Replace all occurences of Opensource with "One True Source"

2Fetch photos from flickr

2Fetch photos from flickr - configurable

2Fetch photos from flickr - url configurable

3Loops

For each item in a feed, do something

3Loops

Translate an English feed to French

3Loops

3Loops

How about doing it for title and description?

3Loops

4Subpipes

5BBC news in flickr

5BBC news in flickr

Can we do this with a subpipe?

6Flickr photos for a user

6Flickr photos for a user

What if we only know the username and not the nsid?

6Flickr photos for a user

6Flickr photos for a user

7Museums in Ottawa on a Map

7Museums in Ottawa on a Map

pipes.yahoo.com/bluesmoon/museums_in_ottawa

Pipes in the wild

Part II: Reading pipes in PHP

1How do you read in a URL in PHP?

1How do you read in a URL in PHP?

   $url = 'http://pipes.yahoo.com/pipes/pipe.run?'
        . '_id=vI7LxsJe3BGRHaLP6UjTQA&_render=php';

   function fetchURL($url)
   {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url );
    curl_setopt($ch, CURLOPT_POST, 0 );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    return curl_exec($ch);
   }

1How do you read in a URL in PHP?

   $url = 'http://pipes.yahoo.com/pipes/pipe.run?'
        . '_id=vI7LxsJe3BGRHaLP6UjTQA&_render=php';

   function fetchURL($url)
   {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url );
    curl_setopt($ch, CURLOPT_POST, 0 );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    return curl_exec($ch);
   }

1How do you read in a URL in PHP?

   $url = 'http://pipes.yahoo.com/pipes/pipe.run?'
        . '_id=vI7LxsJe3BGRHaLP6UjTQA&_render=php';

   function fetchURL($url)
   {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url );
    curl_setopt($ch, CURLOPT_POST, 0 );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    return curl_exec($ch);
   }

   $data = unserialize(fetchURL($url));

Greetz

Philip S Tellis

philip@bluesmoon.info

http://bluesmoon.info/

Made with Eric A Meyer's S5