【问题标题】:Scraping from an interactive chart从交互式图表中抓取
【发布时间】:2019-04-26 16:09:15
【问题描述】:

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

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

你能帮帮我吗? 非常感谢

【问题讨论】:

  • 那是什么网站?该站点必须通过 AJAX 调用以 JSON 格式加载数据,或者他们在初始响应中已经存在数据,请将站点链接发送给我
  • 非常感谢。这是链接bitcoinvisuals.com/ln-capacity

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


【解决方案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 中存在的列

【讨论】:

猜你喜欢
  • 2014-06-08
  • 2021-04-05
  • 2015-08-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多