pYsearch is an open-source Python library for accessing the Yahoo! Search APIs written by Leif Hedstrom. This overview covers version 2.0 which can be downloaded from SourceForge.
Basic usage of pYsearch involves creating a search query object and then executing it to get back a results object. Here's an example showing how to search Yahoo! News:
>>> from yahoo.search.news import NewsSearch
>>> srch = NewsSearch('YahooDemo', query='kittens')
>>> info = srch.parse_results()
>>> info.total_results_available
204
>>> info.total_results_returned
10
>>> info.first_result_position
1
>>> for result in info.results:
... print "'%s', from %s" % (result['Title'], result['NewsSource'])
'Cats, kittens on sale for a discount at Winnipeg shelter', from CBC Manitoba
'Singapore playwright Ovidia Yu', from Radio Singapore International
'News Feature', from Rye and Battle Today
...
The standard query returns the first 10 results. To retrieve the next 10, specify a start parameter.
>>> srch = NewsSearch('YahooDemo', query='kittens', start=11)
>>> info = srch.parse_results()
>>> info.total_results_available
204
>>> info.first_result_position
11
Likewise, you can use a results=20 parameter to change the number of results retrieved at a time (up to a maximum of 50). Other NewsSearch parameters reflect the request parameters listed in the News Search API documentation.
pYsearch includes classes for almost all of the Search APIs. You should consult the pYsearch online documentation for details of which class corresponds to which API.
Re: I Need Freelance for JAVA SCRIPT with imacro
Sun, 21 Oct 2012
Re: Yahoo pipes with google app engine
Sat, 23 Jun 2012
I Need Freelance for JAVA SCRIPT with imacro
Mon, 28 Nov 2011
Yahoo pipes with google app engine
Wed, 29 Sep 2010
Re: Python access to Yahoo groups?
Fri, 17 Sep 2010
More