mirror of
https://github.com/zedeus/nitter.git
synced 2026-01-26 13:22:49 -05:00
Catch failed guest token exception
This commit is contained in:
@@ -57,7 +57,11 @@ proc getGuestToken(agent: string; force=false): Future[string] {.async.} =
|
||||
let headers = genHeaders({"authorization": auth}, agent, base, lang=false)
|
||||
newClient()
|
||||
|
||||
let json = parseJson(await client.postContent($(apiBase / tokenUrl)))
|
||||
var res: string
|
||||
try: res = await client.postContent($(apiBase / tokenUrl))
|
||||
except: return
|
||||
|
||||
let json = parseJson(res)
|
||||
|
||||
if json != nil:
|
||||
result = json["guest_token"].to(string)
|
||||
|
||||
Reference in New Issue
Block a user