Skip to content

Instantly share code, notes, and snippets.

@peterfication
Created April 19, 2017 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterfication/3c62fb50e45693e9fa02b46aed8d4575 to your computer and use it in GitHub Desktop.
Save peterfication/3c62fb50e45693e9fa02b46aed8d4575 to your computer and use it in GitHub Desktop.
Get all challenges of vimgolf.com as a list that can be copy and pasted into a spreadsheet.
// Copy and paste this script into the Javascript console at https://www.vimgolf.com
// and you get a tab delimited list of the entries that can be copied and pasted
// into a spreadsheet.
var resultString = [];
$('#content .grid_7 div h5').each(function(i, e) {
var $link = $(e).find('a');
var url = 'https://www.vimgolf.com' + $link.attr('href');
var urlParts = url.split('/');
var challengeID = urlParts[urlParts.length - 1];
var title = $link.text();
var textParts = $(e).text().split(' - ');
var entriesCount = textParts[textParts.length - 1].split(' ')[0];
resultString += challengeID + '\t' + url + '\t' + title + '\t' + entriesCount + '\n';
});
console.log(resultString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment