Skip to content

Instantly share code, notes, and snippets.

@niknah
Last active January 18, 2022 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niknah/5db7170da701ccbf5d645a2e63987e42 to your computer and use it in GitHub Desktop.
Save niknah/5db7170da701ccbf5d645a2e63987e42 to your computer and use it in GitHub Desktop.
Get OS, size details of Humble Bundle Trove games
// https://www.humblebundle.com/subscription/trove
// sort by date added first
var upto=0;
var results=[];
function getNext() {
jQuery('.dismiss-action').click();
var items=jQuery('button.trove-grid-item');
if(upto>=items.length) {
// results=results.sort(function(a,b) { return a.name.localeCompare(b.name); });
console.log(results);
console.log("Copy and paste json to\nhttps://www.convertcsv.com/json-to-csv.htm\nhttp://tableit.net");
return;
}
items.get(upto).click();
setTimeout(function() {
var name=jQuery('.product-human-name').text();
var osx=jQuery('.hb-osx').length>0;
var windows=jQuery('.hb-windows').length>0;
var linux=jQuery('.hb-linux').length>0;
var sizeTxt=jQuery('.js-file-size').text();
var gbM=/^(.*)\s+GB$/.exec(sizeTxt);
if(gbM) {
sizeTxt=Math.floor( (parseFloat(gbM[1])*1000) )+".00 MB";
}
results.push({name:name, "osx":osx?"🍎":"", linux:linux?"🐧":"", windows:windows?"⊞":"", size:sizeTxt});
getNext();
},1000);
++upto;
}
getNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment