#πŸ”’ Extract description from website

14 messages Β· Page 1 of 1 (latest)

iron osprey
#

Hello, I'm trying to extract a description from a website. The page from which to extract the code is this one: https://www.lladro.com/it_it/figurina-biancaneve-it-it-01009320.html

This is the code snippet:

# Estrazione della descrizione con BeautifulSoup
description = "NO_DESCRIPTION"
try:
    description_element = soup.find("div", class_="mb-2 text-sm 2xl:text-base")
    if description_element:
        description = description_element.get_text(strip=True)
except Exception as e:
    print(f"Descrizione non trovata per {product_url}: {e}")

The code works but it extracts the text contained in another <div> with the same css class "mb-2 text-sm 2xl:text-base". Now extract the text contained in the drop-down menu "Assicurazione LladrΓ³ gratuita", instead I need the description that can be found by pressing the "Dettagli del prodotto" button, after the title "Descrizione:". This information is already present in the code without the need to press the button "Dettagli prodotto".

Can you tell me how I could extract this information?

I hope I was clear. Thanks

opal ridgeBOT
#

@iron osprey

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

small sequoia
iron osprey
small sequoia
#

Might want to anchor it from this div too

#

So grab the product-info-main, then grab the div with class product-description

small sequoia
iron osprey
#

If you press on dettagli prodotto can see it

small sequoia
#

i see

#

anchor it with this ID
product-additional-side-panel

#

//*[@id="product-additional-side-panel"]/div/div[2]/div[2]/div/div[2] might work

opal ridgeBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.