-
-
Save mattn/2908776 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
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