【问题标题】:Performing Google Search using Python code使用 Python 代码执行 Google 搜索
【发布时间】:2019-09-20 10:15:00
【问题描述】:

我正在尝试在 Python 中执行 Google 搜索。

代码如下:

# install lib beautifulsoup4
# install lib google
try:
    from googlesearch import search
except ImportError:
    print("No module named 'google' found")

# to search 
query = input('Search: ')

for j in search(query, tld='com', lang='en', num=10, start=0, stop=None, pause=1.0): 
    print(j) 

起初它运行良好,但再过几次后,此错误弹出并立即关闭我的终端:

【问题讨论】:

标签: python search


【解决方案1】:

429: Too Many Requests 表示您在给定的时间段内发出了很多请求。用于防止dDoS attacksbots。所以它不会让你在短时间内发送大量请求。

要解决这个问题,您可以探索以下内容。

1) 合并和旋转user agents

2) 使用和轮换代理。

【讨论】:

    猜你喜欢
    • 2011-09-25
    • 1970-01-01
    • 2010-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多