我正在尝试获取图像的 src,但我返回的 HTML 代码与网站上显示的 HTML 代码不同。
from bs4 import BeautifulSoup
import requests
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"}
url = "https://www.amazon.de/ASUS-Advanced-Grafikkarte-Speicher-Displayport/dp/B07VM9V59H/ref=sr_1_20?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=1928HLQLPKSTH&keywords=nvidia&qid=1585480732&s=computers&sprefix=nvid%2Ccomputers%2C171&sr=1-20"
response = requests.get(url, headers=headers).text
soup = BeautifulSoup(response, 'lxml')
title = soup.select("#productTitle")[0].get_text().strip()
imgdata = soup.find_all('img', {"alt":title})
print(imgdata)
RISEBY
相关分类