Answer the question
In order to leave comments, you need to log in
How to parse Steam sales history?
I am writing a steam trading platform parser. I found a query that returns a massive json list with the item's sales history for the entire time period. How can I extract data from a given array for a certain period of time, a month, a week, or a certain date?
import steam.webauth as wa
user = wa.WebAuth('login')
session = user.cli_login('password')
session.get('https://store.steampowered.com/account/history')
link = 'https://steamcommunity.com/market/pricehistory/?country=DE¤cy=3&appid=440&market_hash_name=Specialized%20Killstreak%20Brass%20Beast'
resp = session.get(link)
result = resp.json()
print(result)
{'success': True, 'price_prefix': '$', 'price_suffix': '', 'prices': [['Nov 27 2013 01: +0', 16.99, '1'], ['Nov 29 2013 01: +0', 17.205, '2'],.....
Answer the question
In order to leave comments, you need to log in
If it’s simple, then you can simply enter the start and end dates, and then display everything by brute force
start = 'May 29 2014'
end = 'Nov 07 2014'
is_found = False
for data in resp['prices']:
if data[0].startswith(start):
is_found = True
elif data[0].startswith(end):
is_found = False
break
if is_found:
print(data[1])
from datetime import datetime
start = datetime.strptime('May 29 2014', '%b %d %Y')
end = datetime.strptime('Nov 07 2014', '%b %d %Y')
How can I extract data from a given array for a certain period of time, a month, a week, or a certain date?You move through the
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question