mirror of
https://github.com/zedeus/nitter.git
synced 2025-03-04 01:51:12 +00:00
Capture "account locked" API error
This commit is contained in:
parent
1aa9b0dba6
commit
2e13d7b57c
2 changed files with 6 additions and 4 deletions
|
@ -76,8 +76,8 @@ template fetchImpl(result, fetchBody) {.dirty.} =
|
|||
|
||||
if result.startsWith("{\"errors"):
|
||||
let errors = result.fromJson(Errors)
|
||||
if errors in {expiredToken, badToken}:
|
||||
echo "fetch error: ", errors
|
||||
echo "Fetch error, API: ", api, ", errors: ", errors
|
||||
if errors in {expiredToken, badToken, locked}:
|
||||
invalidate(account)
|
||||
raise rateLimitError()
|
||||
elif errors in {rateLimited}:
|
||||
|
@ -93,6 +93,7 @@ template fetchImpl(result, fetchBody) {.dirty.} =
|
|||
fetchBody
|
||||
|
||||
if resp.status == $Http400:
|
||||
echo "ERROR 400, ", api, ": ", result
|
||||
raise newException(InternalError, $url)
|
||||
except InternalError as e:
|
||||
raise e
|
||||
|
@ -125,8 +126,8 @@ proc fetch*(url: Uri; api: Api): Future[JsonNode] {.async.} =
|
|||
result = newJNull()
|
||||
|
||||
let error = result.getError
|
||||
if error in {expiredToken, badToken}:
|
||||
echo "fetchBody error: ", error
|
||||
echo "Fetch error, API: ", api, ", error: ", error
|
||||
if error in {expiredToken, badToken, locked}:
|
||||
invalidate(account)
|
||||
raise rateLimitError()
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ type
|
|||
tweetNotAuthorized = 179
|
||||
forbidden = 200
|
||||
badToken = 239
|
||||
locked = 326
|
||||
noCsrf = 353
|
||||
tweetUnavailable = 421
|
||||
tweetCensored = 422
|
||||
|
|
Loading…
Reference in a new issue