Skip to content

Instantly share code, notes, and snippets.

@somazx
Last active April 15, 2023 16:45
Show Gist options
  • Save somazx/cd2f7064faf484589f9bf5bf7bb26774 to your computer and use it in GitHub Desktop.
Save somazx/cd2f7064faf484589f9bf5bf7bb26774 to your computer and use it in GitHub Desktop.
Humble Bundle Unredeemed Keys Scraper
/*
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"));
})();
@nomq1
Copy link

nomq1 commented Jan 23, 2023

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