从交互式图表中刮取

时间:2018-11-24 09:47:40

标签: web-scraping scrapy screen-scraping scrapy-spider

当您将鼠标箭头放在Y坐标The link to an image that shows my situation. The red X is where my mouse was pointing上时,我想从图表中检索显示数据点信息的信息。

在我的脑海中,我想创建一个刮板,模拟我的鼠标一个接一个地移动像素,每次保存显示的数据。

能帮我一下吗? 非常感谢

1 个答案:

答案 0 :(得分:1)

他们正在从https://bitcoinvisuals.com/static/data/data_daily.csv URL作为CSV加载数据,然后传递到图形

他们正在使用此Javascript代码来处理数据

// Iterate through chunk data
for (i = 0; i < data_csv.length; i++) {
    var day = ( data_csv[i].day == "" ? null : new Date(data_csv[i].day).getTime() );
    var btc = ( data_csv[i].capacity_total == "" ? null : +data_csv[i].capacity_total );

    // If btc exists, try to convert
    if (btc) {
        var usd = ( data_csv[i].price_btc == "" ? null : (btc * +data_csv[i].price_btc) );
    }

    // Push to series
    if (day) {
        // If either exists
        if (btc || usd) {
            series_btc.addPoint([day, btc], redraw = false)
            series_usd.addPoint([day, usd], redraw = false)
        }       
    }
}

请注意,capacity_total是该CSV中存在的列