Skip to content

Instantly share code, notes, and snippets.

@Asbra
Created July 22, 2018 18:57
Show Gist options
  • Save Asbra/92e620d393833056c370331866599bea to your computer and use it in GitHub Desktop.
Save Asbra/92e620d393833056c370331866599bea to your computer and use it in GitHub Desktop.
Utility for exporting your Steam wishlist (game titles)
/*
* Parse your Steam Wishlist to different formats
* Extract Steam Wishlist game titles list as a regex (for use with ruTorrent)
* Can be run as a bookmarklet or through the developer console of your browser
* URL: https://store.steampowered.com/wishlist/
*/
var regex_head = '(?:^(', // Add at start of list
regex_tail = '))', // Add at end of list
repl_space = '[\\s\\._-]', // Replace space characters with this
separator = '|'; // Character to separate the game titles
if (typeof(g_rgAppInfo) == 'undefined' || g_rgAppInfo == null) {
console.log('Failed to fetch wishlist!');
} else {
var output = '',
games = [];
for (var appId in g_rgAppInfo) {
if (!g_rgAppInfo.hasOwnProperty(appId)) continue;
var title = g_rgAppInfo[appId].name;
title = title.replace(new RegExp('[^\\w\\s\\.:-]', 'g'), ''); // Remove non-ASCII chars
if (repl_space != '') title = title.replace(new RegExp(' ', 'g'), repl_space); // Replace spaces
if (title.indexOf(':') !== -1) games.push(title.split(':')[0]); // If there's a : create 2 entries
title = title.replace(new RegExp(':', 'g'), ''); // Remove :
games.push(title);
}
output = regex_head + games.join(separator) + regex_tail;
console.log(output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment