Last active
May 25, 2020 08:41
-
-
Save e39a562r/f7447c376fad3b1bd1db7eba880440a6 to your computer and use it in GitHub Desktop.
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
function downImg(img, fname) { | |
var url = img && img.srcset && img.srcset.replace(/ \d\.?\d?x/g, '').split(', ').pop() || img.src | |
var ext = (url.match(/\..+?$/) || [] )[1] || '.jpeg' | |
$('<a href="'+url + '" download="' + fname + ext + '"/>')[0].click() | |
} | |
function fetchImg (playerurl) {$.ajax(playerurl, {success: (a) => { | |
var name = $('.infobox-header', a).first().text().replace(/\s+$/,'').replace('[e][h] ', '') | |
var teamname = $('.infobox-description:contains(Team)', a).next().text() | |
downImg($('.infobox-image img', a)[0], teamname + ' - ' + name) | |
}})} | |
$('.teamcard-inner table.list td>a[href]').each((i,e) => fetchImg(e.href)) | |
$('.teamcard').each((i, e) => { | |
var teamname = $('a',e).first().text(); | |
downImg($('.floatnone img', e)[0], teamname)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment