我无法从这个网站上刮取物品。python

我无法从这个网站上刮取物品。python,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,我试图刮这个网站上所有的衣服项目,但我不能做到这一点。我在“find_all”中设置了“limit=3”,但它只给出1个结果。如何在一个请求中获得所有结果? 请帮帮我,我受够了 请尝试以下代码: from bs4 import BeautifulSoup import requests def trendyol(url): headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) App

我试图刮这个网站上所有的衣服项目,但我不能做到这一点。我在“find_all”中设置了“limit=3”,但它只给出1个结果。如何在一个请求中获得所有结果? 请帮帮我,我受够了

请尝试以下代码:

from bs4 import BeautifulSoup
import requests

def trendyol(url):
    headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'}
    page = requests.get(url, headers=headers).text
    soup = BeautifulSoup(page, "html.parser")

    list= soup.find("div", {'class':'prdct-cntnr-wrppr'})
    for link in list.find_all('div',{'class': 'p-card-chldrn-cntnr'}):
        print("https://www.trendyol.com" + link.find('a', href=True)['href'])
        print(link.find('div',{'class':'image-container'}).img['alt'])
        print(link.find('span',{'class':'prdct-desc-cntnr-ttl'}).text)

url = "https://www.trendyol.com/erkek+kazak--hirka?filtreler=22%7C175&pi=3"
trendyol(url)

此代码带有打印产品url、标题和alt文本标题。谢谢。

代码中的缩进不正确,请注意拼写和语法。另外,请更详细地描述您包含的代码的问题。对不起,我刚刚开始在这里使用。我试着编辑。我希望现在更清楚了。非常感谢!在soup对象中找不到图像。它是动态加载的。那就好了。请接受我的回答。谢谢,很乐意帮忙。
from bs4 import BeautifulSoup
import requests

def trendyol(url):
    headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'}
    page = requests.get(url, headers=headers).text
    soup = BeautifulSoup(page, "html.parser")

    list= soup.find("div", {'class':'prdct-cntnr-wrppr'})
    for link in list.find_all('div',{'class': 'p-card-chldrn-cntnr'}):
        print("https://www.trendyol.com" + link.find('a', href=True)['href'])
        print(link.find('div',{'class':'image-container'}).img['alt'])
        print(link.find('span',{'class':'prdct-desc-cntnr-ttl'}).text)

url = "https://www.trendyol.com/erkek+kazak--hirka?filtreler=22%7C175&pi=3"
trendyol(url)