Skip to content

Instantly share code, notes, and snippets.

@s0nlxaftrsh0ck
Forked from somazx/scraper.js
Created April 15, 2023 16:45
Show Gist options
  • Save s0nlxaftrsh0ck/ce3b2ce44e3b5e6b0620f7323d929b8a to your computer and use it in GitHub Desktop.
Save s0nlxaftrsh0ck/ce3b2ce44e3b5e6b0620f7323d929b8a 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"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment