<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>daniel shiffman &#187; API</title>
	<atom:link href="http://www.shiffman.net/category/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shiffman.net</link>
	<description></description>
	<lastBuildDate>Wed, 02 Jun 2010 19:55:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Processing Yahoo Search Library</title>
		<link>http://www.shiffman.net/2007/08/05/processing-yahoo-search-library/</link>
		<comments>http://www.shiffman.net/2007/08/05/processing-yahoo-search-library/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 02:51:22 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[p5]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://www.shiffman.net/2007/08/05/processing-yahoo-search-library/</guid>
		<description><![CDATA[Now, I am rather overdue for an update on my upcoming book. I&#8217;ll be posting details soon. However, in the course of finishing up a chapter on String parsing, I discovered that my good friend, the Google SOAP API is no longer being supported (obviously, I&#8217;m a little late on the ball here.) So, I [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.shiffman.net/p5/pyahoo_files/names.jpg"/></p>
<p>Now, I am rather overdue for an update on <a href="http://book.shiffman.net">my upcoming book</a>.  I&#8217;ll be posting details soon.   However, in the course of finishing up a chapter on String parsing, I discovered that my good friend, the <a href="http://code.google.com/apis/soapsearch/">Google SOAP API</a> is no longer being supported (obviously, I&#8217;m a little late on the ball here.) </p>
<p>So, I quickly whipped up a <a href="http://www.processing.org">Processing</a> library to make use of the Yahoo Search API.  Now, you can access the Yahoo! API directly in Processing.  There&#8217;s <a href="http://processing.org/learning/libraries/yahoosearch.html">even an example here</a>.  However, you would have to write your own thread if you wanted to search asynchronously.  In addition, if you&#8217;re not comfortable diving into outside Java APIs, you might struggle to figure out the syntax.   (<a href="http://www.realtimeart.com/switchboard/">Switchboard</a> also provides an interface to the Yahoo! API.)</p>
<p>So I set out (as an example for my book) to make a quick and easy bridge to the Yahoo API.    </p>
<li class="arrow"><a href="http://www.shiffman.net/p5/pyahoo_files/pyahoo.zip">Download the library here</a></li>
<li class="arrow"><a href="http://developer.yahoo.com">Go and get a developer ID</a></li>
<li class="arrow"><a href="http://developer.yahoo.com/download">Download the Yahoo! Search SDK</a>  Find the file: yahoo_search-2.X.X.jar and put it in the library folder (along with the above download).</li>
<p>Finally, take a peek at this example code. </p>
<pre>
// Import the library
import pyahoo.*;

YahooSearch yahoo;

void setup() {
  size(400,400);
  // Make a search object
  yahoo = new YahooSearch(this,"YOUR API KEY HERE");

}

void mousePressed() {
  yahoo.search("processing.org");
  // You can request more results like so (the default is 10):
  // yahoo.search("processing.org",30);
}

void draw() {
  noLoop();
}

// The searches will come in one at a time to here when finished
void searchEvent(YahooSearch yahoo) {
  // You can get the titles, URLs, or Summaries back as an array of Strings
  String[] titles = yahoo.getTitles();
  String[] urls = yahoo.getUrls();
  println("\nI searched for " + yahoo.getSearchString());
  println("There are a total of " + yahoo.getTotalResultsAvailable() + " results available");
  println("Here are the first " + yahoo.getNumberRequested());
  for (int i = 0; i < titles.length; i++) {
    println("___________");
    println("Item # " + i);
    println(titles[i]);
    println(urls[i]);
  }

  // You can also access the Yahoo API Directly by asking for the WebSearchResult object:
  // WebSearchResults results = yahoo.getResults();
  // WebSearchResult[] results = yahoo.getResultsArray();
  // In this mode, make sure to import the Yahoo library up topl
  // import com.yahoo.search.WebSearchResults;
  // See Yahoo API documentation for more
}
</pre>
<p>There's also a fancier example (mostly uncommented, sorry) that produced the image at the top of this post <a href="http://www.shiffman.net/p5/pyahoo_files/names.zip">here</a>.  </p>
<p>Thoughts?  Helpful?  Useful?  </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shiffman.net/2007/08/05/processing-yahoo-search-library/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
