5
我正在嘗試使用rest-client庫從Waze應用程序獲取我的GPS數據。我基本上試圖通過網站https://www.waze.com/虛假登錄。登錄後(您可以使用JohnDoeSpeedy228:gre @ tStory92)當您訪問https://www.waze.com/editor/時,請在查看網絡調用後點擊「驅動器」以查看原始JSON數據。如何使用休息客戶端從Waze獲取GPS數據?
我似乎在已成功登錄,但在進行請求時返回以下
{"users"=>{"objects"=>[]}, "archives"=>{"totalSessions"=>0, "objects"=>[]}}
它應該返回像這樣我的所有驅動器返回的列表:
{
"users":{
"objects":[
]
},
"archives":{
"totalSessions":1,
"objects":[
{
"id":<REDACTED>,
"userID":<REDACTED>,
"existingRoadMeters":2839,
"newRoadMeters":0,
"totalRoadMeters":2839,
"startTime":1456996197000,
"endTime":1456996636000,
"hasFullSession":true
}
]
}
}
這裏的我在想什麼:
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'=>'[email protected]'}
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)
我做錯了什麼?
100%不會混淆兩個帳戶。 – narzero
是的,但我的觀點是,如果手動登錄時沒有記錄的行程,爲什麼您會期望REST API返回它們? –
有三個記錄旅行。 – narzero