humble-bundle-download-scripts/hb_get_titles.js

17 lines
448 B
JavaScript

/*
Bonus: Get book/game titles dumped to the console.
*/
const gameInfo = document.getElementsByClassName("gameinfo");
const gameTitles = [];
for (i in gameInfo) {
var game = gameInfo[i];
if (game && typeof game === 'object') {
let gameTitle = game.getElementsByClassName("title");
if (gameTitle) {
gameTitles.push(gameTitle[0].innerText);
}
}
}
console.log(gameTitles.sort().join('\r\n'));
console.log(`${gameTitles.length} items`);