-1

I would like to do a little script with nodejs that tracks interesting steam promos.

First of all I would like to retrieve the list of games on sale. I tried several things, without success ...

GET request on the store.steampowered.com page (works but only displays the first 50 results because the rest only appears when you scroll to the bottom of the page)

Use of the API but it would be necessary to retrieve the list of all the games but it would take too long to check if each one is in promotion

If anyone has a solution, I'm interested

Thank's a lot

guillaumearnx
  • 142
  • 3
  • 12

1 Answers1

5

You can get the list of featured games by sending a GET request to https://store.steampowered.com/api/featuredcategories, though this may not give you all of the results you're looking for.

import requests

url = "http://store.steampowered.com/api/featuredcategories/?l=english"
res = requests.get(url)
print(res.json())

You can also get all the games on sale by sending a GET request to https://steamdb.info/sales/ and doing some extensive HTML parsing. Note that SteamDB is not maintained by Valve at all. Edit: The following script does the GET request.

import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'DNT': '1',
    'Alt-Used': 'steamdb.info',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
    'Cache-Control': 'max-age=0',
    'TE': 'Trailers',
}

response = requests.get('https://steamdb.info/sales/', headers=headers)
print(response)
hcc
  • 51
  • 1
  • 2
  • steamdb.info doesn't let me perform get request. I've a 403 error with message : "Please enable JavaScript and reload the page" – guillaumearnx May 27 '21 at 22:51
  • Hmm, I got a 200 response from the GET request on my end, though the response is in HTML and quite hard to understand. I'll update the answer with the code I used (in Python). – hcc May 27 '21 at 23:03