skip to Main Content

Html – Accessing nested element using beautifulsoup

I want to find all the li elements nested within <ol class="messageList" id="messageList">. I have tried the following solutions and they all return 0 messages: messages = soup.find_all("ol") messages = soup.find_all('div', class_='messageContent') messages = soup.find_all("li") messages = soup.select('ol > li')…

VIEW QUESTION

Unable to find text from the html content beautifulsoup

from bs4 import BeautifulSoup import re text = "<tr> <td style="width:127.5pt;padding:3.75pt 0in 3.75pt 0in" width="170"> <p class="MsoNormal"><span style="font-size:11.0pt">Job #<o:p></o:p></span></p> </td> <td style="padding:3.75pt 0in 3.75pt 3.75pt"> <p class="MsoNormal"><strong><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>TEST-12311</span></strong><span style="font-size:11.0pt"><o:p></o:p></span></p> </td> </tr>" soup = BeautifulSoup(text,"html.parser") print(soup) job_number = soup.find("span", string="Job #")…

VIEW QUESTION

Woocommerce – How to extract price from web page using Beautiful Soup?

import requests from bs4 import BeautifulSoup URL="https://shop.beobasta.rs/proizvod/smrznuti-spanac/" header={"User Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0","Accept-Language":"en-US,en;q=0.9"} response=requests.get(URL,headers=header) soup=BeautifulSoup(response.text,'html.parser') price_element = soup.find("span",class_="woocommerce-Price-amount amount") print(price_element) I'm trying to extract price from this website but the only thing…

VIEW QUESTION

Html – extract value from span

I want to extract a snow depth value from a weather site to a dataframe. (https://www.yr.no/nb/sn%C3%B8dybder/NO-46/Norge/Vestland) Specifically the snow depth for the Jordalen - NĂ¥sen area. Screen shot The closest I've gotten is printing all the values using this code:…

VIEW QUESTION
Back To Top
Search