Open golddragon007 opened 10 months ago
Hello, It appears that steamdb.info enabled page scraper protection I'll have to find other reliable source for game icons
I think i could use appmanifest_xxxxxx.acf files in steam library folder to obtain installation path, and then find icon there
The game folders itself does not contain ico file. What I see is to tweak the request, like:
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
[...]
sleep(1000);
const infoHtml = await fetch(`https://steamdb.info/app/${gameId}/info/`, {
credentials: 'include',
headers: {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-GB,en;q=0.9",
"Cache-Control": "max-age=0",
"Cookie": "__cf_bm=fGN_dCvGclIqAATXbXEievvLdDEkJZ_oRprryax.OO4-1702671273-1-AXuQpD40xGunkUOj77XNZf0yfgELSfcV98XQA+DqIFrEAWYwuR4hegqpATi1Y7+Y2+sCh6saDrkc/REZvlxYZ+0=; cf_chl_2=1d9cd64c0f7f188; cf_clearance=FbMK3zd6EPhcImVCldzKP3ZZcYRbmn8APqsU1qb8YXY-1702671652-0-1-96bbd0f6.4f4623f2.5087bd24-250.2.1702671273",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Sec-Ch-Ua": '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
}
})
with this around 40 request can be made before IP ban.
Or the cleaner if you get it from steam directly. Everything on that page can be got from steam itself in one way or another. (i.e. steam console).
Or the cleaner if you get it from steam directly. Everything on that page can be got from steam itself in one way or another. (i.e. steam console).
That's what i wanted in the first place, but i didn't found a public API that lets me do that. And i don't want to dwell into SteamWorks API.
The game folders itself does not contain ico file.
They do, the icons are embedded into .exe files. I can probably use System.Drawing.Icon.ExtractIcon from .NET to extract them. I would have to rewrite this utility in C# though.
with this around 40 request can be made before IP ban.
Thanks for checking this out, i'll add an option to add delay between requests, i'll notify you when it's done.
i'll add an option to add delay between requests
I don't think that would help tho, because there are some http headers and cookies that their rate-limiter expects, which are missing from my programmatic request.
You need to copy the headers that I sent. I just literally cloned one of my browser requests of mine. With cookies and everything, as I did not login on that page it's safe for me to share all together.
You need to copy the headers that I sent. I just literally cloned one of my browser requests of mine. With cookies and everything, as I did not login on that page it's safe for me to share all together.
These headers would only work for your ip, and only temporarily
Instead of downloading from steamdb, get it from steam directly. http://cdn.akamai.steamstatic.com/steamcommunity/public/images/apps/{appid}/{clienticon}.ico
Get the appid and clienticon from appinfo.vdf in the appcache folder
Hello,
This script is blocked by the website, it returns a banned page, therefore it does not find the ico URL and can't download the file.