我正在尝试编写一个python脚本来显示google中针对给定搜索查询的前5个结果的链接
我使用的是beautiful soup,在检查了google的html之后,我发现可以在标签div^{cl1}中找到搜索结果链接$
import bs4, requests
mySearch=input()
address='http://www.google.com/search?q='+mySearch
googleRes=requests.get(address)
googleSoup=bs4.BeautifulSoup(googleRes.text)
linkBlocks=googleSoup.select('div.r a')
但是,列表linkBlocks为空,而不是用搜索结果链接填充。如何将搜索结果链接到linkBlocks列表中
使用
User-Agent
相关问题 更多 >
编程相关推荐