gui*_*rnx -1 node.js steam-web-api discord
我想用nodejs 做一个小脚本来跟踪有趣的蒸汽促销。
首先,我想检索正在销售的游戏列表。我尝试了几件事,但没有成功......
store.steampowered.com 页面上的 GET 请求(有效,但仅显示前 50 个结果,因为其余结果仅在您滚动到页面底部时显示)
使用API,但需要检索所有游戏的列表,但检查每个游戏是否正在促销需要很长时间
如果有人有解决方案,我很感兴趣
多谢
您可以通过向https://store.steampowered.com/api/featuredcategories发送 GET 请求来获取特色游戏列表,但这可能无法为您提供所需的所有结果。
import requests
url = "http://store.steampowered.com/api/featuredcategories/?l=english"
res = requests.get(url)
print(res.json())
Run Code Online (Sandbox Code Playgroud)
您还可以通过向https://steamdb.info/sales/发送 GET 请求并进行一些广泛的 HTML 解析来获取所有促销游戏。请注意,SteamDB 根本不是由 Valve 维护的。编辑:以下脚本执行 GET 请求。
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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3865 次 |
| 最近记录: |