Python Forum
Beautifulsoup4 help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Beautifulsoup4 help (/thread-36296.html)



Beautifulsoup4 help - samuelbachorik - Feb-05-2022

Hi iam trying to scrape some info from websites and i want to ask somebody who knows beautifulsoup if can show me how to get that price from this code.
beautifulsoup


Thank you


RE: Beautifulsoup4 help - snippsat - Feb-05-2022

Should post code of what you have tried,and try not to post image as we can use code from it as a test.
from bs4 import BeautifulSoup

html = '''\
<b class="price price"> 206 </b>'''

soup = BeautifulSoup(html, 'lxml')
b_tag = soup.find('b', class_="price price")
print(b_tag.text.strip())
Output:
206
So this is the basic of it,now can price be generated bye JavaScript,
then look into Selenium(can still use BS as can redirect page_source to it) or try to catch json response.