Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Getting Values from Multiple Classes

I am trying to scrape the price from:

https://store.steampowered.com/search/?filter=topsellers&snr=1_241_4_action_12

I am using:

soup.find_all('div',{'class':'col search_price responsive_secondrow'})

However, there are discounted prices, which are not present in the above div class, instead they can be found using:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

soup.find_all('div',{'class':'col search_price discounted responsive_secondrow'})

I have scraped the Titles of the games, and want the prices also to be correspondingly in the same row, so how do I accomplish merging both the conditions for scraping ?

>Solution :

You can use it’s parent element instead, which contains both prices.

for i in soup.find_all('div',{'class':"col search_price_discount_combined responsive_secondrow"}):
    print(i.text.replace("\n","").strip())

Result:

$49.99
$59.99
$999.00
$59.99
$59.99
-2%$89.98$87.98
$19.99
-30%$59.99$41.99
$59.99
-70%$59.99$17.99
-10%$29.99$26.99
-5%$39.99$37.99
-30%$29.99$20.99
$29.99
-10%$16.99$15.29
$19.99
-25%$19.99$14.99
$13.99
$99.99
$14.99
$59.99
$19.99
-50%$9.99$4.99
$59.99
$39.99
$59.99
$59.99
-66%$14.99$5.09
$39.99
$49.99
$39.99
-50%$59.99$29.99
-10%$29.99$26.99
-40%$59.99$35.99
$29.98
-67%$59.99$19.79
-50%$29.99$14.99
-30%$19.99$13.99
$2.99
$2.99
$2.99
$2.99
$2.99
$2.99
$14.99
-30%$59.99$41.99
$44.99
-30%$59.99$41.99
$59.99
$59.99
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading