G
G
gogolplay422020-05-24 21:43:43
Python
gogolplay42, 2020-05-24 21:43:43

Parsing the price of an item on the Steam marketplace?

Hey! How to parse the price of goods on the trading platform.
The user enters a link to an item and the program displays the price of this item every ten minutes.

I tried to do it myself, without moms and dads, but it didn’t work out that way. Here is my code:

import requests
from bs4 import BeautifulSoup as bs

url = input()
r = requests.get(url).text
soup = bs(r,'html.parser') 
search = soup.select("#market_commodity_forsale > span.market_commodity_orders_header_promote:nth-child(3)")
print(search.text)


Link example:
https://steamcommunity.com/market/listings/730/Pri...

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2020-05-24
@gogolplay42

Steam prices are loaded from the API, using such links, in the JSON response, which contains the keys lowest_sell_orderand the highest_buy_orderones you need. The product ID is stored in another JSON, which is on the page at the link you wrote in the question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question