Skip to content

Instantly share code, notes, and snippets.

@flori
Last active August 18, 2022 15:48
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 flori/853cc2413cee24c0f2bfe2229fe107dd to your computer and use it in GitHub Desktop.
Save flori/853cc2413cee24c0f2bfe2229fe107dd to your computer and use it in GitHub Desktop.
Download all imported PGNs from lichess
var downloadTime = 3 * 1000
function getIds() {
var ids = []
jQuery('.game-row__overlay').each(
function () {
var h = jQuery(this).attr('href')
var id = h.match(/[a-z0-9]+/i)[0]
ids.push(id)
})
return ids
}
var ids = getIds()
var count = 1;
jQuery.each(ids, function(i, id) {
setTimeout(function() {
var url = `https://lichess.org/game/export/${id}?imported=1`
console.log(`Downloading URL ${count++} of ${ids.length} ${url} …`)
window.location.href=url
}, i * downloadTime)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment