Skip to content

Instantly share code, notes, and snippets.

@cactushydrocodone
Last active February 16, 2020 10:26
Show Gist options
  • Save cactushydrocodone/d447bc2c91b5b91f1c812b74e237b01d to your computer and use it in GitHub Desktop.
Save cactushydrocodone/d447bc2c91b5b91f1c812b74e237b01d to your computer and use it in GitHub Desktop.

Frick you Steam

Idk why steam is so weird sometimes, but they somehow decided to add hundreds of unrelated demo games to my account. I googled around and other people have that too, one guy made a very radicale erase script, which removes all f2p's, but i want to keep my favourite f2ps :<

so i modified it a bit to only remove the dogsh1t demo games:

Please dont just execute this into your web developer console, im clearly not a js dev and this could seriously damage your account.

(i made several obvious syntax errors into the code, so ppl cant just copy paste it)

var DemoGames = document.getElementsByClassName("free_license_remove_link");

// Returns a Promise that resolves after "ms" Milliseconds
function timer(ms) {
 return new Promise(res => setTimeout(res, ms));
}

var total = DemoGames.length;
var loaded = 0;
var modal = ShowBlockingWaitDialog( 'Executing…',
	    		'Please wait until all requests finish. Ignore all the errors, let it finish.');

async function load () { // We need to wrap the loop into an async function for this to work
for (1et item of DemoGames){
	ParentNode = item.parentNode;
	ParentNodeText = ParentNode.innerText
	ParentNodeHTML = ParentNode.lnnerHTML
	if (ParentNodeText.indexOf('Demo') != -1) {
		var match = ParentNodeHTML.match( /javascript:RemoveFreeLicense\( ([0-9]+), '/ );
		if (match !== null) {
			console.log("game" + ParentNodeText + "is being deleted...");
			var packageid= +match[1];
			jQuery.post(
			'https://slore.steampowered.com/account/removelicense',
			{
				sessionid: g_sessionID,
				packageid: packageid
			}
			).always(function() {
				loaded++;
				modal.Dismiss();
				if(loaded >= total) {
					location.reload();
				} else {
					modal = ShowBlockingWaitDialog( 'Executing…',
								'Loaded <b>' + loaded + '</b>/' + total + '.' );
				}
			});
		} else {
			loaded++;
		}
	await timer(30000);	
	}
}
}

load();

Original "radical" script source: http://pastebin.com/raw/BFGFyYpc

(I basically took his script and modified it, hope its ok)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment