How to get GPS data from Waze using rest-client?

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?

+5
source share
1 answer

I assume you are confusing two accounts. Are you sure you are logged in as JohnDoeSpeedy228? If there are no user sessions when entering the site manually, I would not expect the code to work.

We cannot find any of your drives.

Have you started driving with the Waze app? If so, make sure you are logged into the Map Editor with the same credentials that you use in the application.

+1
source

Source: https://habr.com/ru/post/1244343/


All Articles