Tuesday, October 19, 2010

How To Create a Yahoo! Pipe Google Search To Power Your Twitter Stream (Not So Easy Version)

I REALLY like Yahoo! Pipes.

Last week, I did a little poking around on the Yahoo! Pipes site on a recommendation from Dino Dogan. Being a programmer by trade, I’m a daily keyboard jockey since I’m typing lines of code for living.

But, I also have a background in sequential illustration (comic books to you) and graphics/DTP, so the visual aspect of the programming method employed by Pipes has a real appeal for me. To my mind, this is how programming should be: connecting little visual building blocks of functionality rather than QWERTY tippy-tapping.

Visual and easy, yet powerful. I can just FEEL both hemispheres of my brain tingling in excitement.

Enough With The Creepy Sensory References, Show Us How To Make a Pipe!
Alright, alright.

In a previous blog post, I wrote a tutorial on how to create a simple Yahoo Search and turn it into an RSS feed for your Twitter stream, using Yahoo! Pipes.

So much for an introduction. Let’s look at something a little fancier: a YQL (Yahoo Query Language) pipe.

Schlep on over to http://pipes.yahoo.com/pipes/, and click the “Create a Pipe” button. (This is assuming, of course, that you’ve already registered a Yahoo! ID as outlined in my previous tutoria!)
yahoopipes

You remember this screen, yes? The library to the left, the debugger at the bottom, and canvas in the middle. In the library, click and drag on the data source named “YQL”, placing it on the canvas.
yql01

YQL is modeled after SQL or Structured Query Language, which is the language used to move information in and out of relational databases. With YQL, the internet becomes your database (or more specifically, data that’s offered via web services). That’s right: the Whole Great Big Enchilada. Suh-WHEEEEET.

I think I’ll call it the interwebase.

GASP! WHEEZE! CHOKE!
So I hear a couple of you starting to hyperventilate. Don’t worry, I’m not going to make you do any programming…I’m going to do it for you!

Copy the following text.


Now, before you start to feel your brain go all numb and your eyes start to cross looking at this code, let me break it down and translate for you. Don’t worry, I’ll go easy on ya.

select * from
This is called a “select” statement. Essentially, we’re saying “Give me all the columns from “ some datasource, usually a database table when using SQL. In this case, we’re using “rss” which represents an RSS feed.

where url=
This is called the “where” clause. We’re saying, “But don’t just give me ALL of the  possible results, I want only certain ones, and this is what I want you to look for”. It’s how we get specific. In this case we want results where the URL equals a certain value.

You’ll notice that buried in the query string is “social+media+marketing”. Those are our search keywords; we’re looking for Google News search results for the keyword combination of “social”, “media”, and “marketing”.

Now, paste the code into the “Enter Your Query” text box in your YQL module.
yql02

If you’re feeling extra geeky and want to play around with the YQL query, click “Try in the console”. You’ll be presented with the YQL console below:
yql03

The top text box allows you to edit the query and test different values in the search; simply substitute different search keywords, separated by a plus (+) sign, for “social+media+marketing”. Click the “Test” button and view the results in the “Formatted” window. When you get tired of playing around with YQL, return to your Pipes canvas and our original YQL module.

Of course, our YQL module isn’t any use all by himself; he needs to buddy up with the ‘ol output module. You remember how to connect ‘em, right?
yql04

After saving and naming your brand-spanking new pipe, click “Back to My Pipes” to navigate to your pipe list. Your newest pipe displays at the top of the list. Click on the pipe’s name to bring up the pipe description.
yql05

And again, if you’ve been reading our previous blog posts on Yahoo! Pipes (and shame on you if you haven’t!), this page will look familiar, including the sample search results.
yql06

What you do with your YQL feed is up to you, but if you want to setup Twitterfeed to update your Twitter account with this boatload of links, click the “Get as RSS” button.
yql07

Copy that URI in the address field, and bop on over to Twitterfeed to configure your new RSS feed. Need help? Just see this previous blog post!

No comments:

Post a Comment