Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LINEで馬券を購入する / Purchase a betting ticket at LINE

Avatar for taminif taminif
August 03, 2018

LINEで馬券を購入する / Purchase a betting ticket at LINE

関西Node学園3時限目

Avatar for taminif

taminif

August 03, 2018
Tweet

More Decks by taminif

Other Decks in Technology

Transcript

  1. ࣮૷͢Δ const puppeteer = require(‘puppeteer'); (async () => { const

    browser = await puppeteer.launch({headless: true}); const page = await browser.newPage(); await page.setViewport({width: 640, height: 460}); await page.goto(‘https://www.ipat.jra.go.jp/’); //////////////////////////////////////////// })(); $ISPNFΛىಈ ৽͍͠λϒΛ։͘ ΢Οϯυ΢αΠζΛܾఆ 63-Λࢦఆͯ͠ભҠ
  2. LambdaͰಈ͔ͨ͠ -BNCEBͰ ಈ࡞͢Δ"1* -BNCEBݺͼग़͠ +40/ \ QMBDFbവؗ  SBDF/Pb 

    SBDFS/P``  BNPVOU  ^ ʢิ଍ʣ "84-BNCEBͷ࠷େλΠϜΞ΢τઃఆ͸ ඵ෼ ભҠ͕ଟ͗͢Δͱ͕࣌ؒ଍Γͳ͍ Մೳੑ͸͋Δ
  3. LINE BotͰഅ݊Λߪೖ͢Δ ʢਖ਼֬ʹ͸͜͜ʹ-*/&͞Μͷ αʔόʔ͕͋Δʣ ϝοηʔδ  വؗ   

    -*/&ʹೖྗ͞Εͨ ৘ใΛड෇ -BNCEB༻ʹՃ޻ +40/ \ QMBDFbവؗ  SBDF/Pb  SBDFS/P``  BNPVOU  ^
  4. Ԡ౴ϝοηʔδΛฦ͢ \ QMBDFbവؗ  SBDF/Pb  SBDFS/P``  BNPVOU 

    ^ വؗ    ύϥϝʔλʔ͕ਖ਼ৗͳΒ -BNCEBΛݺͼग़ͯ͠ Ԡ౴ϝοηʔδΛૹΔ -BNCEB͔Β-BNCEBΛඇಉظͰ ݺͼग़͍ͯ͠ΔͷͰ੒ޭ͔ͨ͠͸ෆ໌
  5. const puppeteer = require(‘puppeteer'); (async () => { const browser

    = await puppeteer.launch({headless: true}); const page = await browser.newPage(); await page.setViewport({width: 1920, height: 2160}); await page.goto(‘https://www.ipat.jra.go.jp/’); })(); ը໘શ͕ͯ࿮಺ʹ͓͞·ΔΑ͏ͳେ͖͞ ʢղܾࡦʣ ը໘Λେ͖͘͢Δ
  6. ͦΕͧΕͷ࢖͍෼͚ • waitFor
 -> ϛϦඵΛࢦఆɻࢦఆ͚ͨ࣌ؒͩ͠଴ͭ • waitForNavigation
 -> Ҿ਺ͳ͠ɻ •

    waitForSelector
 -> ηϨΫλͰࢦఆɻཁૉ͕දࣔ͞ΕΔ·Ͱ଴ͭ ->͜ΕΒ͚ͩͰ͸ͳ͍ɻଞʹ΋·ͩ͋Δ