Created
May 13, 2016 20:32
-
-
Save xuio/52e0cd778e3af2a21cf198f2c90c7161 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const Request = require('request'); | |
const curlToJson = require('curl-to-json'); | |
let old=0; | |
// 1st class | |
const request = curlToJson(`curl 'http://ice.portal1/api1/rs/status' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://ice.portal1/' -H 'Cookie: scr=1280x0800; vzn=ICE100; Apache=10.205.31.137.1463166299873019' -H 'Connection: keep-alive' -H 'X-Features: {"video":["hds","mp4","ogg"],"audio":["hds","m4a","mpeg","ogg"],"game":["flash","html5"],"browser":"Webkit Version 50.0.2661.94","device":"Sonstiges Device"}' --compressed`); | |
//2nd class | |
//const request = curlToJson(`curl 'http://ice.portal2/api1/rs/status' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36' -H 'Accept: application/json, text/plain, */*' -H 'Referer: http://ice.portal1/' -H 'Cookie: scr=1280x0800; vzn=ICE100; Apache=10.205.31.137.1463166299873019' -H 'Connection: keep-alive' -H 'X-Features: {"video":["hds","mp4","ogg"],"audio":["hds","m4a","mpeg","ogg"],"game":["flash","html5"],"browser":"Webkit Version 50.0.2661.94","device":"Sonstiges Device"}' --compressed`); | |
const printSpeed = () => { | |
Request( | |
request, | |
function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
//console.log(body); | |
const obj = JSON.parse(body); | |
if(obj.speed !== old){ | |
old = obj.speed; | |
console.log(obj.speed); | |
} | |
//console.log(obj.speed); | |
} | |
}); | |
setTimeout(printSpeed, 1000); | |
} | |
printSpeed(); | |
/* | |
curl 'http://ice.portal1/api1/rs/status' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36' -H 'Accept: application/json, text/plain, *\/*' -H 'Referer: http://ice.portal1/' -H 'Cookie: scr=1280x0800; vzn=ICE100; Apache=10.205.31.137.1463166299873019' -H 'Connection: keep-alive' -H 'X-Features: {"video":["hds","mp4","ogg"],"audio":["hds","m4a","mpeg","ogg"],"game":["flash","html5"],"browser":"Webkit Version 50.0.2661.94","device":"Sonstiges Device"}' --compressed | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment