有没有一种方法可以在网页中找到绘图图形数据? [英] Is there a method to find the plot graph data in a web page?

查看:62
本文介绍了有没有一种方法可以在网页中找到绘图图形数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是网络开发人员,请多多包涵.

但是在这种情况下,您需要清除参数才能真正获得正确的信息.我不知道您使用哪种语言,如果您使用Python,则代码如下:

 导入请求进口大熊猫数据= request.get("https://www.etoro.com/sapi/userstats/CopySim/Username/hyjbrighter/OneYearAgo").json()['simulation'] ['oneYearAgo'] ['chart']数据= pandas.DataFrame(数据)打印(数据) 

输出:如果使用R,请使用 jsonlite 包.

I'm not a web developer, so please bear me.

https://www.etoro.com/people/hyjbrighter/chart

I know that there are several libraries to plot graph in Javascript but how can I check if a specific page is using highchart or another competitor?

I expect to find some kind of Json in the source code but how can I find it?

解决方案

The trick is to open the Network tab of Dev Tools, reload the page, and search for the piece of data that you want to scrape. Here I saw a number is 21361.15, I searched for it and detected the JSON file is from https://www.etoro.com/sapi/userstats/CopySim/Username/hyjbrighter/OneYearAgo?callback=angular.callbacks._0&client_request_id=2ce991a6-0943-4111-abd3-6906ca92e45c.

But you need to clear the parameters in this situation to actually get the proper information. I don't know which language you use, if you use Python, here is the code:

import requests
import pandas
data = requests.get("https://www.etoro.com/sapi/userstats/CopySim/Username/hyjbrighter/OneYearAgo").json()['simulation']['oneYearAgo']['chart']
data = pandas.DataFrame(data)
print(data)

Output: If you use R, use jsonlite package.

这篇关于有没有一种方法可以在网页中找到绘图图形数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆