This file contains 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
// g100pon #19 為替情報の取得 | |
@Grab(group='net.sourceforge.nekohtml', module='nekohtml', version='1.9.14') | |
import org.cyberneko.html.parsers.SAXParser | |
class dummy {} // ver1.6 互換の為の class annotationとしての@grap | |
url = 'http://ja.exchange-rates.org/converter/JPY/BRL/100' | |
def parser = new XmlSlurper(new SAXParser()) | |
def HTML = parser.parse(url) | |
def userIDs = HTML.'**'.findAll{ | |
it.name() == 'SPAN' && it.@id == 'ctl00_M_lblToAmount' // <SPAN class="username"> | |
}.collect{ it.text() } // A要素の値 | |
userIDs.each{ id -> println "現在 [100] 円は [${id}] ブラジルレアル" } | |
// 円ドルレートはありがちそうなので 円レアルレートとしました。 | |
// 急激な円高で、ブラジル債をやっている人は気が気ではないと思います。 | |
// なのでレアルにしました。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment