Last active
October 12, 2015 00:38
-
-
Save tec27/3944709 to your computer and use it in GitHub Desktop.
Pull Dota2 Hero Info from Liquipedia
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
JSON.stringify( | |
Array.prototype.slice.call($('.halfbox > li > a > img').map(function(i, img) { | |
var $img = $(img), | |
$link = $img.parent(), | |
host = document.location.protocol + '//' + document.location.host, | |
imgParts = $img.attr('src').split('/'), | |
imgName = imgParts[imgParts.length-1]; | |
return { | |
name: $link.attr('title'), | |
thumb: host + $img.attr('src').replace('/dota2/images/', '/dota2/images/thumb/') + '/68px-' + imgName, | |
page: host + $link.attr('href') }; | |
} | |
), 0) | |
); |
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
JSON.stringify( | |
Array.prototype.slice.call($('tr[valign="top"] > td > div > h3 ~ ul > li').map(function(i, li) { | |
var $li = $(li) | |
, $link = $li.children('a').eq(1) | |
, $logo = $li.find('img').first() | |
, host = document.location.protocol + '//' + document.location.host | |
return { name: $link.text() | |
, page: host + $link.attr('href') | |
, logo: host + $logo.attr('src') | |
} | |
}), 0) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just run in Chrome debugger on: http://wiki.teamliquid.net/dota2/Portal:Heroes