I am trying to get GPS data from a Waze application using rest-client lib. I'm just trying to fake a login through the website https://www.waze.com/ . After logging in (you can use JohnDoeSpeedy228: gre @ tStory92), when you visit https://www.waze.com/editor/ , click on "Drives" after viewing the network calls that you will see raw JSON data.
I seem to have logged in successfully, but when asked to return a list of all my drives, it returns the following
{"users"=>{"objects"=>[]}, "archives"=>{"totalSessions"=>0, "objects"=>[]}}
It should return something like this:
{ "users":{ "objects":[ ] }, "archives":{ "totalSessions":1, "objects":[ { "id":<REDACTED>, "userID":<REDACTED>, "existingRoadMeters":2839, "newRoadMeters":0, "totalRoadMeters":2839, "startTime":1456996197000, "endTime":1456996636000, "hasFullSession":true } ] } }
Here is what I am trying:
require 'rest-client' require 'json' GET_CSRF_URL = "https://www.waze.com/login/get" SESSION_URL = "https://www.waze.com/login/create" SESSION_LIST_URL = "https://www.waze.com/Descartes-live/app/Archive/List" SESSON_DATA_URL = "https://www.waze.com/Descartes-live/app/Archive/Session" AUTH = {'user_id'=>'JohnDoeSpeedy228','password'=>' gre@tStory92 '} req = RestClient.get(GET_CSRF_URL) csrfhash = req.cookies csrfhash['editor_env'] = 'row' headers = {'X-CSRF-Token'=>csrfhash['_csrf_token']} log = RestClient::Request.execute( method: :post, url: SESSION_URL, cookies: csrfhash, headers: headers, payload: AUTH ) ses = RestClient::Request.execute( method: :get, url: SESSION_LIST_URL, cookies: log.cookies, payload: {'minDistance'=>1000,'count'=>50, 'offset'=>0} ) puts JSON.parse(ses)
Am I doing something wrong?