gpt4 book ai didi

ruby - 如何使用 rest-client 从 Waze 获取 GPS 数据?

转载 作者:数据小太阳 更新时间:2023-10-29 07:19:00 24 4
gpt4 key购买 nike

我正在尝试使用 rest-client 库从 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 ,我也不希望代码工作。

We can't find any of your drives.

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

关于ruby - 如何使用 rest-client 从 Waze 获取 GPS 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35768474/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com