Skip to content

Instantly share code, notes, and snippets.

@tec27
Last active October 12, 2015 00:38
Show Gist options
  • Save tec27/3944709 to your computer and use it in GitHub Desktop.
Save tec27/3944709 to your computer and use it in GitHub Desktop.
Pull Dota2 Hero Info from Liquipedia
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)
);
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)
)
@tec27
Copy link
Author

tec27 commented Oct 24, 2012

Just run in Chrome debugger on: http://wiki.teamliquid.net/dota2/Portal:Heroes

@tec27
Copy link
Author

tec27 commented Feb 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment