Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beautifulsoup4 help
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to write 3 Columns to MariaDB? BrandonKastning 21 7,018 Mar-23-2020, 05:51 PM
Last Post: ndc85430
  BeautifulSoup4 plugin help Lathem01 2 2,040 Feb-16-2020, 11:56 AM
Last Post: snippsat
  Cannot import BeautifulSoup4 as bs4 and BeautifulSoup4 not in same directory B5473829 1 6,445 Jul-05-2019, 06:55 PM
Last Post: snippsat
  BeautifulSoup4, How to get an HTML tag with specific class. Broadsworde 6 10,994 Nov-22-2018, 05:25 PM
Last Post: snippsat
  How to use BeautifulSoup4 with pandas series type of html data? PrateekG 4 4,926 Apr-26-2018, 07:33 AM
Last Post: PrateekG
  What's a good practice project for learning BeautifulSoup4, which has a real use case league55 2 2,744 Jan-27-2018, 11:29 PM
Last Post: league55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020