Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Bing::Search Count

by welle (Beadle)
on Sep 17, 2011 at 17:33 UTC ( #926560=perlquestion: print w/ replies, xml ) Need Help??
welle has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I am experimenting with Bing::Search to get search results in my application. I read some documentation but i am not able to set the number of results retrieved by the module. I think the max number possible through the API sould be 50. By default 10 results are showed. Any one more have an answer?

use Bing::Search; use Bing::Search::Source::Web; my $search = Bing::Search->new( AppId => 'my ID', Query => 'Inflation site:europa.eu language:de filetype:pdf', Count => '&Web.Count=50' ); my $source = Bing::Search::Source::Web->new(); $search->add_source( $source ); my $response = $search->search(); print $_->Url ."\n" for @{$response->results};

Comment on Bing::Search Count
Download Code
Re: Bing::Search Count
by keszler (Priest) on Sep 17, 2011 at 18:18 UTC

    Untested, (no AppID)Tested, based on Bing::Search::Source::Web:

    use strict; use Bing::Search; use Bing::Search::Source::Web; my $search = Bing::Search->new( AppId => 'my ID', Query => 'Inflation site:europa.eu language:de filetype:pdf', ); my $source = Bing::Search::Source::Web->new( Web_Count => 50, Web_Offset => 0, ); $search->add_source( $source ); my $response = $search->search(); print $_->Url ."\n" for @{$response->results};

    Updated - got AppId, fixed code

      it works perfectly, thank you very much!

Re: Bing::Search Count
by DanielSpaniel (Scribe) on Sep 17, 2011 at 18:45 UTC

    I'm sure you must have your reasons, but do you really need to use the module at all? It's pretty straight-forward to construct your own URI request to the API, and simple to change any parameter you want.

    Not sure about the param's for the module, because I've not used it, but you should be able to get 50 results (that's the maximum allowed in one request by the API).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://926560]
Approved by keszler
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-12-29 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls