xgoogle谷歌搜索返回顶部网址
我正在使用xgoogle这个工具来获取某个关键词的前10个网址。我的代码是:
from xgoogle.search import GoogleSearch
gs = GoogleSearch("google scraper")
gs.results_per_page = 10
results = gs.get_results()
for res in results:
print res.url.encode('utf8')
但是问题是,它只随机打印出几个网址。希望能得到一些帮助,谢谢!!
1 个回答
0
试试这个方法来获取谷歌上的网址。
from google import search
for url in search('put your search query here', stop=15):
print(url)
你可以通过设置stop=你想要的任何数字来限制网址的数量。
如果这个方法对你有效,请回复告诉我。
祝好,
Sourabh