Replace restricted UserResultByIdQuery endpoint

Fixes #1433
This commit is contained in:
Zed 2026-08-17 06:30:18 +07:00
commit 0ac9bc2678
3 changed files with 29 additions and 2 deletions

View file

@ -58,7 +58,7 @@ proc getGraphUser*(username: string): Future[User] {.async.} =
proc getGraphUserById*(id: string): Future[User] {.async.} =
if id.len == 0 or id.any(c => not c.isDigit): return
let
url = apiReq(graphUserById, """{"rest_id": "$1"}""" % id)
url = apiReq(graphUserById, userByRestIdVars % id)
js = await fetchRaw(url)
result = parseGraphUser(js)

View file

@ -9,7 +9,7 @@ const
graphUser* = "IGgvgiOx4QZndDHuD3x9TQ/UserByScreenName"
graphUserV2* = "-ZzAG_Bckx16LMbEvHC3lg/UserResultByScreenNameQuery"
graphUserById* = "-DAaa9jPxPswYeI2fZ9rug/UserResultByIdQuery"
graphUserById* = "xvmVfRLmnr1alc5f2dib0Q/UserByRestId"
graphUserTweetsV2* = "LE3eTyeqhBh2g-fX85O2eQ/UserWithProfileTweetsQueryV2"
graphUserTweetsAndRepliesV2* = "AcYHjc_YAx-9_rKWdMsKvA/UserWithProfileTweetsAndRepliesQueryV2"
graphUserTweets* = "PNd0vlufvrcIwrAnBYKE9g/UserTweets"
@ -174,6 +174,11 @@ const
"withCommunity": false
}""".replace(" ", "").replace("\n", "")
userByRestIdVars* = """{
"userId": "$1",
"withSafetyModeUserFields": true
}""".replace(" ", "").replace("\n", "")
communityTweetsVars* = """{
"communityId": "$1", $2
"count": 20,