Skip to content

Instantly share code, notes, and snippets.

@supermomonga
Created March 6, 2013 17:36
Show Gist options
  • Save supermomonga/5101271 to your computer and use it in GitHub Desktop.
Save supermomonga/5101271 to your computer and use it in GitHub Desktop.
let altnames = {
\ 'ujm' : 'ujihisa',
\ 'tyru1' : 'tyru',
\ 'momonga' : 'supermomonga'
\ }
let source = {}
let no = 33746
let url = printf('http://atnd.org/events/%d', no)
let dom = webapi#html#parseURL(url)
for tr in dom.find('table').childNodes('tr')
unlet! tds
unlet! name
let tds = tr.childNodes('td')
if len(tds) == 4
let name = tds[2].value()[1:-1]
if name != ''
if has_key(altnames, name)
let name = altnames[name]
endif
let source[name] = has_key(source, name) ? source[name] + 1 : 1
endif
endif
endfor
echo source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment