groovyã§outputzã®æåæ°ãåå¾ãã
Outputzã¯èªåã®å
¥åæåæ°ããã®ã³ã°ãã¦ããããµã¼ãã¹ã
ã©ã¤ããã°ã®ä¸é¨ã¨ãã¦ä½¿ãã«ã¯ãã£ã¦ããã®ãµã¼ãã¹ã ã¨æãã
APIãå
¬éããã¦ãã®ã§ãå種ã¨ãã£ã¿ãçµ±åéçºç°å¢ãªã©ã®ã½ããããã¤ã³ãããããããã¨ãã§ããã
Firefoxã®ã¢ããªã³ãTwitterã§ã¯Tweenã対å¿ãã¦ãã
ã§ãããã¼ã¿ãåå¾ããAPIããªãã
2010å¹´æ«ã«1å¹´ã®ã¾ã¨ããè¡ã£ã¦ãã¨ãã«ãoutputzã®ãã¼ã¿ãåå¾ãããã¨ããã
以ä¸ã®ã¨ã©ã¼ã«ãªã£ã¦ããä»å¹´ãã®ãã¼ã¿ãåç
§ã§ããªãã£ãã
ãä»æãã使ç¨ãã¦ãã4ã¶æãããã¾ã§ããéå»ã«ããã®ã¼ããªãã£ãã
(ä»ã¯ãç»é²ããæã®2009/7ã¾ã§ãããã®ã¼ããããã ã)
æ¨æ¥ã®ãã¼ã¿ãåå¾ããGroovyã¹ã¯ãªãããæ¸ããã
ã¹ã±ã¸ã¥ã¼ã©ã¼ã§æ¥ä»ãå¤ãã£ãã¨ãã«åå¾ãã¦ããã°ããã ããã
ãã¡ã¤ã«ã«ãã®ã³ã°ãã¦ããã¦ãæçµçã«ã¯ãTimeplotã§ã°ã©ãåãããã
ã½ã¼ã¹
@Grab('net.sourceforge.htmlunit:htmlunit:2.8') import com.gargoylesoftware.htmlunit.WebClient MAGIC_WORD="ï¼ï¼ï¼ï¼ï¼" //outputz ã®å¾©æ´»ã®åªæ webClient = new WebClient() configPage = webClient.getPage('http://outputz.com/config/') form =configPage.getForms() field = form[0].getInputByName('magic_word') field.setValueAttribute(MAGIC_WORD) button = form[0].getInputByValue('register') result = button.click() yesterday = (new Date() -1).format("yyyyMMdd") println yesterday dailyPage = webClient.getPage("http://outputz.com/daily/${yesterday}") /* ex <span>1,987</span>bytes</p> */ span = dailyPage.getByXPath("id('contentBox')/div[1]/p")[0] /* ex 1,987 bytes */ text = span.asText() /* ex 1,987â1987 */ dailyByte =( text.split()[0] =~ /,/).replaceAll("") record = (new Date() -1).format("yyyy-MM-dd") + ",${dailyByte}" println record file = new File("C:\\usr\\var\\outputz\\outputz.txt") file.append(record)
å®è¡çµæ
[D:\workspace\groovy_SandBox]groovy outputz.groovy 2>nul 2011-01-07,2276
大éã«è¦åã¨runtimeErrorãã§ãã®ã§ã表示ç¨ã«æ¨æºã¨ã©ã¼ã¯æ¨ã¦ãã
åè
æ°ã«ãªã¢ã
EVOLGã®æè¢ã¯ãç¹æ®ç¹ç¶ã«ã¢ã¯ãªã«ãã¦ã¼ã«ãæ··ãè¾¼ããã¨ã§æè¢ãä»ããã¾ã¾iPhoneãiPodãªã©å¤ãã®æºå¸¯ç«¯æ«ã«æ¡ç¨ããã¦ããéé»æ°å®¹éå¼ã¿ããããã«ã®æä½ãå¯è½ã«ãã¾ãããå¤å½©ãªã«ã©ã¼ã¨ãã¶ã¤ã³æ§ãæã¡åãããå ¨ãæ°ããæè¢ã§ãã
é貨 HIGHTIDE DAILY DEPOT
ï¿¥ 3,780ï¼ç¨è¾¼ãéæå¥