Skip to content

Instantly share code, notes, and snippets.

@bertrandmartel
Created June 3, 2020 23:00
Show Gist options
  • Save bertrandmartel/ff498db51c36cc227b7a186c521bc78a to your computer and use it in GitHub Desktop.
Save bertrandmartel/ff498db51c36cc227b7a186c521bc78a to your computer and use it in GitHub Desktop.
search items in a specific collections on the Steam Market
import requests
import json
r = requests.get("https://steamcommunity.com/market/appfilters/730")
tags = json.loads(r.text)["facets"]["730_ItemSet"]["tags"]
winter_offensive_tag = [
t[0]
for t in tags.items()
if t[1]["localized_name"] == "The Winter Offensive Collection"
][0]
r = requests.get(
"https://steamcommunity.com/market/search/render/",
params = {
"query": "",
"start": 10,
"count": 20,
"search_descriptions": 0,
"sort_column": "name",
"sort_dir": "asc",
"appid": 730,
"category_730_ItemSet[]": f"tag_{winter_offensive_tag}",
"category_730_ProPlayer[]": "any",
"category_730_StickerCapsule[]": "any",
"category_730_TournamentTeam[]": "any",
"category_730_Weapon[]": "any",
"norender": 1
})
data = json.loads(r.text)
print(len(data["results"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment