Last active
April 15, 2023 16:45
-
-
Save somazx/cd2f7064faf484589f9bf5bf7bb26774 to your computer and use it in GitHub Desktop.
Humble Bundle Unredeemed Keys Scraper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Purpose: easily obtain a list of your humble bundle games that haven't been redeemed. | |
Instructions: | |
1) Log into Humble Bundle as usual. | |
2) Navigate to https://www.humblebundle.com/home/keys | |
3) Open browser console and run the following script in the console | |
Script will dump to console the scraped list of all your unredeemed game keys. | |
Copy and paste to spread sheet, or direct to friends to offer them copies. | |
*/ | |
(function hb_games_scraper() { | |
// reset to page 1 | |
while( prev = $(".pagination:first").find(".hb-chevron-left")[0] ) { (prev).click(); } | |
// show only redeemed | |
$("#hide-redeemed").prop("checked", true); | |
// begin scrape | |
var entries = []; | |
while ( next = $(".pagination:first").find(".hb-chevron-right")[0] ) { | |
$("td.game-name h4").each( (_g,h) => entries.push($(h).text()) ); | |
next.click(); | |
} | |
// grab last page's contents - thanks @nemo9955 | |
$("td.game-name h4").each( (_g,h) => entries.push($(h).text()) ); | |
// output list to console | |
console.log(entries.join("\n")); | |
})(); |
With them now giving you keys for everything you get through humble choice you might as well export games and keys now.
replace
$("td.game-name h4").each( (_g,h) => entries.push($(h).text()) );
with
$("td.game-name h4").each( (_g,h) => {entries.push($(h).text()+", "+$(h).parent().parent().find("td.js-redeemer-cell div.key-redeemer div.container div.keyfield-value").text()); });
and it outputs game, key
thanks to @gpmidi for that
had to modify it on firefox
(function hb_games_scraper() {
// reset to page 1
while( prev = $(".pagination:first").find(".hb-chevron-left")[0] ) { (prev).click(); }
// show only redeemed
$("#hide-redeemed").prop("checked", true);
// begin scrape
var entries = [];
while ( next = $(".pagination:first").find("i.hb-chevron-right")[0] ) {
$("td.game-name h4").each( (_g,h) => entries.push($(h).text()) );
next.click();
}
$("td.game-name h4").each( (_g,h) => entries.push($(h).text()) );
// output list to console
console.log(entries.join("\n"));
})();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nemo9955 hmmm very good point.