Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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 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};

Replies are listed 'Best First'.
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 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://926560]
Approved by keszler
[marioroy]: Hello all. After several attempts, am able to move forward and will soon release a Parallel:: ForkManager compatible MCE::Hobo:: Manager, also MCE::Hobo::Simple, and refactored MCE::Hobo engine supporting multiple instances. Wait works beautifully.
[marioroy]: MCE::Shared has been refined that it allows sharing Tie::File and hash objects containing {fh} key.
[marioroy]: It's taken so long to take Hobo to a new level. Threads-like and Parallel:: ForkManager management capaiblities.
[marioroy]: This will complete the 4 years in the making and likely time to move on to something els.
[marioroy]: s/els/else.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2017-05-26 08:26 GMT
Find Nodes?
    Voting Booth?