1
0
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:
Zed
2020-01-10 18:18:22 +01:00
parent 23647f1d7f
commit 0924ea033d
2 changed files with 8 additions and 2 deletions

View File

@@ -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)