0

looking to scrape the following values from the disney store but i can't properly get them, this is the value that i need to get, you can find it at the checkout step:

<form action="https://www.shopdisney.it/carrello?dwcont=C2055615000" method="post" name="dwfrm_cart_d0pvbnrmmxtk" novalidate="">

i basically need to scrape the value inside action but while doing it in this way i do not get anything:

soup = BeautifulSoup(checkout.content,'lxml')
    step1 = soup.find('form')['action']
    print(step1)

instead of getting: https://www.shopdisney.it/carrello?dwcont=C2055615000 i keep getting https://www.shopdisney.it/search, how can i get it? If i try to scrape it by finding 'action' i don't get anything, how could i do it?

soup = BeautifulSoup(checkout.content,'lxml')
    step1 = soup.find('action')
    print(step1)

The source of the HTML can be found in https://www.shopdisney.it/carrello , but before reaching it you need to add to cart one item and then you'll find a similiar url to the one that i'm looking to scrape.

PS: if you need more stuff do not report my question as somebody did previously, just ask for it...

1 Answers1

0

Try:

step1 = soup.find('form').get('action')

More info: Extracting an attribute value with beautifulsoup

Ezra
  • 471
  • 3
  • 14
  • same error i don't get the correct value Thanks for your time! – Sizzurp Jun 30 '21 at 17:47
  • Please add a more complete code sample to help us understand your problem. Are you *sure* that you want the action destination, and that you're getting the right form from the page? Try printing the output of soup.find('form') and seeing what you get. – Ezra Jun 30 '21 at 19:07