Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Firefox-收集LAB.min.js使用的数据_Javascript_Jquery_Angularjs_Firefox_Graph - Fatal编程技术网

Javascript Firefox-收集LAB.min.js使用的数据

Javascript Firefox-收集LAB.min.js使用的数据,javascript,jquery,angularjs,firefox,graph,Javascript,Jquery,Angularjs,Firefox,Graph,我有一个设备-斯蒂贝尔·埃尔特隆热泵-家,我可以通过网络界面跟踪它。 我只能访问上个月和本月。 但是我想以数字的方式保存所有数据,而不是像图像一样保存 首先,我必须得到原始数据。我知道如何使用Firefox和Firebug插件将数据复制/粘贴到文件中。。。手动。它使用angularjs.1.0.6,我从Firebug显示的一个get中获取原始数据: GET https://thesite/api/data/1036493/heatEnergy/today?noCacheDummyValue=1

我有一个设备-斯蒂贝尔·埃尔特隆热泵-家,我可以通过网络界面跟踪它。

我只能访问上个月和本月。
但是我想以数字的方式保存所有数据,而不是像图像一样保存

首先,我必须得到原始数据。我知道如何使用Firefox和Firebug插件将数据复制/粘贴到文件中。。。手动。它使用
angularjs.1.0.6
,我从Firebug显示的一个get中获取原始数据:

GET https://thesite/api/data/1036493/heatEnergy/today?noCacheDummyValue=1459148624909
GET https://thesite/api/data/1036493/outTemp/today?noCacheDummyValue=1459148624905
GET https://thesite/api/data/1036493/heatEnergy/lastMonth?noCacheDummyValue=1459148708330
GET https://thesite/api/data/1036493/outTemp/lastMonth?noCacheDummyValue=1459148708321
如果我能做,你会更好 -直接侵入LAB.min.js数据? -通过使用我通常的登录帖子调用
curl
,然后使用上面的
GET
s收集数据

下面是我的
curl
login
POST
调用的样子:

    curl -o myraw.data --data-urlencode "userName=tutu&password=xx"  'https://thesite/api/login?noCacheDummyValue=1458825357449' \
     -H 'Host: thesite' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0' \
     -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' \
     -H 'X-Requested-With: XMLHttpRequest' \
     -H 'Content-Type: application/json;charset=utf-8' \
     -H 'Referer: https://thesite/mobile/app/app.html' \
     -H 'Content-Length: 44' -H 'Cookie: JSESSIONID=1m5aputqimremdk95fgbtmgo9'  \
     -H 'Proxy-Authorization: Basic ??' -H 'DNT: 1'   \
     -H 'Connection: keep-alive' 
但我什么也得不到。现在,我对Firebug的复制响应体/粘贴功能感到满意

现在我得到的原始数据看起来像JSON,我猜:

[{"values":
[{"options":null,"webId":null,"value":"8.9","date":1458842750000,"writeValue":null,"unit":null}
,"options":null,"webId":null,"value":"9.1","date":1458842451000,"writeValue":null,"unit":null}
,{"options":null, 
...
,{"options":null,"webId":null,"value":"5.5","date":1458774051000,"writeValue":null,"unit":null}],"unit":"°C"}]
现在我得到了我的数据,我想这很容易。但我在尝试处理JSON数据时感到头疼。。。我知道有些人已经试过了:

我的JSON中只有规则模式,最近(重新)发现了
sed
。因此,我使用了我的新电源(在替代值中添加一个真正的换行符是多么困难):

并获取我的数据,如
“温度”
/
“时间戳”

。。。在这一点上我很高兴!当我绘制它时,它看起来就像我在Firefox窗口中看到的一样

注意:我计算我的时间轴是基于1970年1月1日以来的毫秒数


如果有人感兴趣,我写了一些东西,用
curl
在那里检索数据:

我需要做的第一件事是获得如何连接到页面的灵感:我认为这不是您想要提取的数据。jquery代码可能对数据进行了一些操作,并创建了这个canvas。我想要的数据是允许我从设备中推断温度测量值的数据。在某些时候,它必须以某种格式下载到我的浏览器中,对吗?是的,这是真的,但图像中的不是实际数据。我指的是检查元件中的那个。您可以在“网络”选项卡上查看所有发送的请求和接收的数据。然后,您可以编写一个小代码来点击这个url,然后根据需要将数据保存到文件中。但这取决于服务器如何接受来自未知服务器的请求domain@Reddy,你说得对。它使用angularjs.1.0.6,我从Firebug显示的get中获取原始数据。
cat rawdata.txt | tr -d '\n' | sed 's/},{/\
/g' | sed 's/"options":null,"webId":null,"value"://' |\
sed 's/,"writeValue":null,"unit":null//' |sed 's/,"date":/;/' |\
sed 's/\[{"values":\[{//' |sed 's/}\],"unit":"°C"}\]/\
    /' | sed 's/}\],"unit":"kWh"}\]/\
    /' > pureData.csv
ju@ju-HP-Compaq-dc7900-Small-Form-Factor:~/INSTALL/myproj$ cat pureData.csv
"8.9";1458842750000
"9.1";1458842451000
"9.3";1458842150000
"9.4";1458841851000
"9.7";1458841550000
"9.9";1458841251000
"10.0";1458840950000
...