Created
April 3, 2020 14:51
-
-
Save master-stm/8109af8e295f6a9336db634dc920b8d7 to your computer and use it in GitHub Desktop.
scraping steam to get recent top sellers specials + converting currency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import html5lib | |
from pip._vendor import requests | |
myURL = requests.get("https://store.steampowered.com/search/?filter=topsellers&specials=1") | |
soup = BeautifulSoup(myURL.text, "html5lib") | |
for game in soup.find_all("div", class_="responsive_search_name_combined"): | |
game_title = game.find('span', class_="title").text.rstrip() | |
game_discount = abs(int(game.find('div', class_="col search_discount responsive_secondrow").text.lstrip().rstrip().strip('%'))) | |
game_price = float(game.find('div', class_="col search_price discounted responsive_secondrow").span.text.lstrip().strip('€').replace(',', '.')) | |
final_price = game_price-((game_discount/100)*game_price) | |
print(f'{game_title} {game_discount}% discount, new price {round(final_price*0.335701,2)} KWD') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment