我如何使用Perl的Google :: Search来查找特定的URL? [英] How do I use Perl's Google::Search to look for specific URLs?
问题描述
基于AJAX Search API的Google :: Search模块看起来效果不好,或者它只是我?
For例如,我使用Firefox来搜索谷歌: http://bloggingheads.tv/forum/ member.php?u = 12129
它带来的结果。
但是,当我使用模块:
$ google_search = Google :: Search->网页(q =>http:// bloggingheads .tv / forum / member.php?u = 12129);
@result = $ google_search->全部;
我没有在数组中找到任何东西。
任何想法?
看起来像这个API不会带来像手动搜索一样的结果,我错过了什么?
我有一个与西里尔语查询类似的问题。来自CPAN的 Google :: Search
和 REST :: Google
对我来说都不起作用 - 他们回馈较少或者与手动测试相比没有结果。
最后,我用 WWW :: Mechanize
和 HTML :: TreeBuilder作为
。
以下是获取结果统计信息的示例:
my $ tree = HTML :: TreeBuilder-> new_from_content($ content);
if(my $ div = $ tree-> look_down(_tag =>'div',id =>'resultStats')){
my $ stats = $ div- > as_text();
}
其他{warnno stats}
The Google::Search module, which is based on the AJAX Search API, doesn't seems to work very well, or it is just me?
For example, I use firefox to search google for: http://bloggingheads.tv/forum/member.php?u=12129
It brings results.
But when I use the module this way:
$google_search = Google::Search->Web ( q => "http://bloggingheads.tv/forum/member.php?u=12129" );
@result = $google_search->all;
I get nothing in the array.
Any idea?
Seems like this API doesn't bring the same results like when searching manually, am I missing something?
I had a similar problem with cyrillic queries. Both Google::Search
and REST::Google
from CPAN didn't work for me - they were giving back fewer or no results compared to manual test.
Eventually I wrote a scraping module using WWW::Mechanize
and HTML::TreeBuilder
.
Here's a sample to get result stats:
my $tree = HTML::TreeBuilder->new_from_content($content);
if (my $div = $tree->look_down(_tag => 'div', id => 'resultStats')) {
my $stats = $div->as_text();
}
else { warn "no stats" }
这篇关于我如何使用Perl的Google :: Search来查找特定的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!