我正在尝试使用rest-client lib从Waze应用程序中获取我的GPS数据。我基本上是想通过https://www.waze.com/网站伪造登录名。登录后(您可以使用JohnDoeSpeedy228:gre @ tStory92)在访问https://www.waze.com/editor/时,在检查网络调用后单击“驱动器”,您将看到原始的JSON数据。
我似乎已成功登录,但是在提出要求返回所有驱动器列表的请求时,它返回以下内容
{"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'=>'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)
难道我做错了什么?
最佳答案
我的猜测是您混淆了两个帐户。您确定以JohnDoeSpeedy228登录时已记录驱动器吗?如果手动登录该站点时没有该用户的 session ,则我也不希望代码起作用。