Skip to content

Instantly share code, notes, and snippets.

@mattn
Forked from kaneshin/tepco.vim
Created June 11, 2012 06:47
Show Gist options
  • Save mattn/2908776 to your computer and use it in GitHub Desktop.
Save mattn/2908776 to your computer and use it in GitHub Desktop.
scriptencoding utf-8
let url = 'http://www.tepco.co.jp'
let indexj = '/cc/press/index-j.html'
let res = webapi#http#get(url.indexj)
if res.header[0] != 'HTTP/1.1 200 OK'
echo 'Oops! Something wrong.'
endif
let data = iconv(res.content, 'utf-8', &encoding)
let dom = webapi#html#parse(data)
for item in dom.findAll("dd")
let link = item.find("a")
if !empty(link)
echo link.value()
echo " " url.link.attr["href"]
endif
endfor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment