Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ruby API for Yahoo Search Web Services

1 view
Skip to first unread message

Premshree Pillai

unread,
Mar 1, 2005, 12:26:03 PM3/1/05
to
So everybody knows about Yahoo's Search Web Services. Downloaded the
stuff... no Ruby API.

Hacked one. See http://www.livejournal.com/users/premshree/56199.html

Not very elegant and all. Prolly someone else could come up with
something nice.

--
Premshree Pillai
http://www.livejournal.com/users/premshree/


Paul Duncan

unread,
Mar 1, 2005, 10:09:57 PM3/1/05
to
* Premshree Pillai (premshre...@gmail.com) wrote:
> So everybody knows about Yahoo's Search Web Services. Downloaded the
> stuff... no Ruby API.

Damn, you beat me to it :).

> Hacked one. See http://www.livejournal.com/users/premshree/56199.html
>
> Not very elegant and all. Prolly someone else could come up with
> something nice.
>
> --
> Premshree Pillai
> http://www.livejournal.com/users/premshree/

--
Paul Duncan <pa...@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

signature.asc

NAKAMURA, Hiroshi

unread,
Mar 2, 2005, 2:42:34 AM3/2/05
to
Hi,

Premshree Pillai wrote:
> So everybody knows about Yahoo's Search Web Services. Downloaded the
> stuff... no Ruby API.
>
> Hacked one. See http://www.livejournal.com/users/premshree/56199.html

And here's mine. Only an example for proof of concept.

query = ARGV.shift or raise ArgumentError

require 'soap/marshal'
class MyXMLHandler < SOAP::EncodingStyle::SOAPHandler
Namespace = 'urn:myxmlhandler'
add_handler
def decode_parent(parent, node)
super if parent.node # ignore absence of SOAP envelop things.
end
end

require 'http-access2'
url = 'http://api.search.yahoo.com/NewsSearchService/V1/newsSearch'
param = {
'appid' => '!!! set_your_appid_here !!!',
'query' => query,
'results' => 3,
'language' => 'en',
'results_sort' => 'rank'
}
result = HTTPAccess2.get_content(url, param)

opt = {:default_encodingstyle => 'urn:myxmlhandler'}
soap = SOAP::Processor.unmarshal(result, opt)

SOAP::Mapping.soap2obj(soap).Result.each do |result|
next unless result["Thumbnail"]
p result.Thumbnail.Url
end

Regards,
// NaHi

signature.asc

Premshree Pillai

unread,
Mar 2, 2005, 4:01:53 AM3/2/05
to
On Wed, 2 Mar 2005 12:09:57 +0900, Paul Duncan <pa...@pablotron.org> wrote:
> * Premshree Pillai (premshre...@gmail.com) wrote:
> > So everybody knows about Yahoo's Search Web Services. Downloaded the
> > stuff... no Ruby API.
>
> Damn, you beat me to it :).

:-) Well, maybe you could come up with a neat one.

0 new messages