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"));
})();
@somazx
Copy link
Author

somazx commented Sep 18, 2020

@nemo9955 hmmm very good point.

@parkervcp
Copy link

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

Copy link

ghost commented Apr 10, 2022

I ran with the Humble's 'Hide redeemed keys & entitlements' option enabled and the script only outputs game titles to the console — this isn't meant to reveal any keys? Applies to the parkervcp's edit as well.

image

@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