【发布时间】:2011-03-08 03:27:57
【问题描述】:
我正在使用 xgoogle 库,每当我要求它获取搜索结果的数量时,它就会出现零。 (这不是我的代码,我直接从示例中复制了它)有什么想法吗?
【问题讨论】:
-
他实际上已经接受了一些答案,我不知道为什么它显示为0%。
我正在使用 xgoogle 库,每当我要求它获取搜索结果的数量时,它就会出现零。 (这不是我的代码,我直接从示例中复制了它)有什么想法吗?
【问题讨论】:
这在我的 Debian 系统上显示了 1000000 个结果:
jcomeau@intrepid:/usr/src/xgoogle$ cat xg.py
#!/usr/bin/python
from xgoogle.search import GoogleSearch, SearchError
try:
gs = GoogleSearch("quick and dirty")
gs.results_per_page = 50
results = gs.get_results()
print 'results', gs.num_results # number of results
for res in results:
print res.title.encode("utf8")
print res.desc.encode("utf8")
print res.url.encode("utf8")
print
except SearchError, e:
print "Search failed: %s" % e
【讨论】: