[Python] Beatifulsoup not returning full html of the page

Discussão em 'Python' iniciado por Stack, Abril 15, 2025.

  1. Stack

    Stack Membro Participativo

    I want to scrape few pages from amazon website like title,url,aisn and i run into a problem that script only parsing 15 products while on the page it is showing 50. i decided to print out all html to console and i saw that the html is ending at 15 products without any errors from the script. Here is the part of my script

    keyword = "men jeans".replace(' ', '+')

    headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3 GTB5'}
    url = "https://www.amazon.com/s/field-keywords={}".format(keyword)

    request = requests.session()
    req = request.get(url, headers = headers)
    sleep(3)
    soup = BeautifulSoup(req.content, 'html.parser')
    print(soup)

    Continue reading...

Compartilhe esta Página