我正在尝试使用 python 执行 google 搜索,使用
googlesearch
python 模块。我不只是想要输出url,我还想要url中信息的描述,基本上是网页抓取。
这是包含高级参数的代码:
from googlesearch import search
print(search('my search', advanced=True)) #advanced argument is true, to make the search detailed
但我收到此错误:
TypeError:search() 得到了意外的关键字参数“advanced”
我不知道为什么会发生这种情况。
我从 https://pypi.org/project/googlesearch-python 获得了此代码。我还想指出,我不想使用其他网络抓取库,例如
bs4
(BeatifulSoup4) 或 urllib
,特别是因为我想弄清楚为什么高级参数不被接受。
尝试使用安装它:
pip install googlesearch-python