Created
December 13, 2016 16:03
-
-
Save urakozz/05093525be5a86972d0412e3355486be to your computer and use it in GitHub Desktop.
Drive Now
This file contains 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"; | |
let https = require("https"); | |
let headers = { | |
"Accept": "application/json;v=1.8", | |
"Origin": "https://de.drive-now.com", | |
"X-Language": "de", | |
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 YaBrowser/16.10.0.2309 Safari/537.36", | |
"X-Api-Key": "adf51226795afbc4e7575ccc124face7", | |
"Referer": "https://de.drive-now.com/", | |
"Accept-Language": "ru,en;q=0.8", | |
}; | |
//Accept-Encoding: gzip, deflate, sdch, br | |
let response = ""; | |
let req = https.request({ | |
host: 'api2.drive-now.com', | |
port: 443, | |
path: '/cities/6099?expand=full', | |
method: 'GET', | |
gzip: true, | |
headers: headers, | |
}, (res) => { | |
console.log('STATUS: ' + res.statusCode); | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
response += chunk; | |
}); | |
res.on("end", () => { | |
// console.log(data); | |
let data = JSON.parse(response); | |
data["cars"]["items"].filter((v) => v["fuelLevelInPercent"] < 25).forEach((v) => { | |
console.log(v["address"]); | |
}); | |
}) | |
}); | |
req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment