Skip to content

Instantly share code, notes, and snippets.

@albertovadia
Forked from petersvp/SteamQueryBatchKey.js
Created November 4, 2021 15:39
Show Gist options
  • Save albertovadia/269fa42b18858be72d3316b213f5f27b to your computer and use it in GitHub Desktop.
Save albertovadia/269fa42b18858be72d3316b213f5f27b to your computer and use it in GitHub Desktop.
Batch Query Steam Keys for activation on SteamWorks
// 1. GO TO SteamWorks, into the Query CD Key page, here: https://partner.steamgames.com/querycdkey/
// 2. Fill in your keys below:
// 3. Go to DevTools, Console, and paste all of this here there!
// 4. Report will be printed to the console.
keys = `
0ZQR4-N0H7K-AEJ77
D05V5-P47AP-4ET3Q
GGJZ5-ZN0BR-F74C5
FWZP4-2IXHB-GYV3A
`
var keylist = keys.split("\n");
keylist.forEach(key => {
if(key.length<17) return;
function reqListener () {
let body = this.responseText;
let result = body.split('<h2>Activation Details</h2>')[1];
if (!result && !err) {
console.log('Error quering CD Key ' + key);
}
result = result.split('</table>')[0];
result = result.match(/<td>.*<\/td>/g);
result = result.map(function (line) {
return line.replace(/<[^>]*>/g, '');
});
let line = [key, (result[0] === 'Activated') ? '"' + result[1] + '"' : result[0]].join('\t');
console.log(line);
}
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "https://partner.steamgames.com/querycdkey/cdkey?cdkey="+key+"&method=Query");
oReq.send();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment