Created
December 9, 2024 19:58
-
-
Save jrwarwick/d4e4e3056b3ad8c2d155dcf809e5b07c to your computer and use it in GitHub Desktop.
GOG User Profile Game Library export
This file contains hidden or 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
//https://www.gog.com/u/Your.User.Name.Here/games?sort=recent_playtime | |
var myUsername = JSON.parse(localStorage['ngStorage-user']).username | |
window.navigation.navigate("https://www.gog.com/u/"+myUsername+"/games?sort=recent_playtime"); | |
//Let that load first, then... | |
//Paste into console: | |
function download(filename, text, type="text/plain") { | |
// Create an invisible A element | |
const a = document.createElement("a"); | |
a.style.display = "none"; | |
document.body.appendChild(a); | |
// Set the HREF to a Blob representation of the data to be downloaded | |
a.href = window.URL.createObjectURL( | |
new Blob([text], { type }) | |
); | |
// Use download attribute to set set desired file name | |
a.setAttribute("download", filename); | |
// Trigger the download by simulating click | |
a.click(); | |
// Cleanup | |
window.URL.revokeObjectURL(a.href); | |
document.body.removeChild(a); | |
} | |
function extractGameList() { | |
var games = Array.from(document.querySelectorAll("h1.prof-game__title")); | |
var text = ''; | |
games.forEach(a => text += ("\n" + a.innerHTML)); | |
console.log(text); | |
download("gog_games_list.txt",text); | |
} | |
window.scrollTo(0, document.body.scrollHeight); | |
//Give the background lazy load of the rest of the games about 4 seconds to finish. | |
setTimeout(extractGameList,4000); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment