puppetterで日経平均をスクレイピング

github.com

qiita.com

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('http://www.nikkei.com/markets/kabu/');

    var data = await page.$eval('span.mkc-stock_prices', item => {
        return item.textContent;
    });

    console.log(data)

    await browser.close();
})();

imabari.hateblo.jp