【问题标题】:python web scraping on google search "dragon ball wallpaper"谷歌搜索“龙珠壁纸”上的python网页抓取
【发布时间】:2021-02-06 17:56:44
【问题描述】:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import urllib
import random
from string import ascii_lowercase

def makesoup(url):
    thepage=urlopen(url)
    soupdata=BeautifulSoup(thepage, 'html.parser')
    return soupdata

soup=makesoup("https://www.google.com/search?q=dragon+ball+super+wallpaper&source=lnms&tbm=isch&sa=X&ved=0ahUKEwihzY6OvpfdAhVrJcAKHRi2D8cQ_AUICigB&biw=1366&bih=662")
print(soup.text)

我在urlopen() 上收到错误消息。我真的需要一些帮助。

【问题讨论】:

标签: python web-scraping


【解决方案1】:

Google 不喜欢通过脚本或框架请求。如果您想从其他应用程序通过 google 进行搜索,您应该尝试使用 google search api。

https://developers.google.com/custom-search/json-api/v1/overview

是的,它限制为每天 100 个请求,但它是唯一合法的选择。

【讨论】:

    猜你喜欢
    • 2021-06-27
    • 2021-01-17
    • 1970-01-01
    • 1970-01-01
    • 2020-05-03
    • 2023-03-29
    • 2022-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多