Skip to content

Instantly share code, notes, and snippets.

@Bluscream
Created April 19, 2018 00:48
Show Gist options
  • Save Bluscream/bb9e8b339951301a165ee40e5803187a to your computer and use it in GitHub Desktop.
Save Bluscream/bb9e8b339951301a165ee40e5803187a to your computer and use it in GitHub Desktop.
Free Steam Games
(function(){
if( location.href.match( /^https:\/\/store\.steampowered\.com\/account\/licenses\/?$/ ) === null ){
alert( 'Please run this on Steam\'s account page details: https://store.steampowered.com/account/licenses/' );
window.location = 'https://store.steampowered.com/account/licenses/';
return;
}
var freePackages = [];
var total = freePackages.length;
var num = (freePackages.length/50);
num = Math.floor(num)+1;
num = num +1;//CHANGE NUMBER OF REQUESTS
var j=0;
var m=60;//CHANGE MINUTES BETWEEN REQUESTS
var millisec=m*60000+5000;
var modal = ShowBlockingWaitDialog( 'Executing:', j+1 + '/' + num );
function freepack(){
var ownedPackages = {};
jQuery( '.account_table a' ).each( function( i, el ){
var match = el.href.match( /javascript:RemoveFreeLicense\( ([0-9]+), '/ );
if( match !== null ){
ownedPackages[ +match[ 1 ] ] = true;
}
});
var i = 0, loaded = 0, package = 0, min=m;
for( ; i < total; i++ ){
package = freePackages[ i ];
if( ownedPackages[ package ] ){
loaded++;
continue;
}
jQuery.post('//store.steampowered.com/checkout/addfreelicense', {
action: 'add_to_cart',
sessionid: g_sessionID,
subid: package
}).always( function(){
loaded++;
if( loaded >= total ){
modal.Dismiss();
modal = ShowBlockingWaitDialog('Waiting... ', "Time left: " + min + " minutes");
return;
} else{
modal.Dismiss();
modal = ShowBlockingWaitDialog( 'Running...', 'Loaded ' + loaded + '/' + total + '' );
}
});
}
j++;
if (j>=num){
modal.Dismiss();
modal = ShowBlockingWaitDialog('Ending...');
clearInterval(free_timer);
location.reload();
return;
}
var mytimer = setInterval(function(){
min--;
modal.Dismiss();
modal = ShowBlockingWaitDialog('Waiting... ', "Time left: " + min + " minutes");
if(min==0){
modal.Dismiss();
modal = ShowBlockingWaitDialog("Restarting... " + 'Executing:', j+1 + '/' + num);
clearInterval(mytimer);
}
}, 60000);
}
freePackages = [
];
freepack();
var free_timer=setInterval( freepack, millisec);
}())
if( location.href.match( /^https:\/\/steamdb\.info\/freepackages\/?$/ ) === null ){
window.location = 'https://steamdb.info/freepackages/';
}
var nodelist = document.querySelectorAll('span.package');
var unwanted = ["demo", "trailer", "teaser", "trial", "trailed", "traiiler"];
var freeSub = [];
nodelist.forEach(function(item) {
var push = true;
var split = item.textContent.replace(/[{()}]/g, '').replace(/[\[\]']+/g, '').replace(/\:/g, ' ').replace(/\./g, ' ').replace(/\_/g, ' ').toLowerCase().split(" ");
split.reverse();
split.forEach(function(itemsplit, index) {
if (unwanted.includes(itemsplit.trim())) {
push = false;
return;
}
});
if (push) {
freeSub.push(item.textContent.trim().split(",")[0]);
}
});
console.log(freeSub.join(","));
@Micha16007
Copy link

bro please give me video on youtube

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