Explorar o código

Add missing error codes for unavailable tweets

Zed %!s(int64=3) %!d(string=hai) anos
pai
achega
725f601c9b
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 1 1
      src/parser.nim
  2. 2 0
      src/types.nim

+ 1 - 1
src/parser.nim

@@ -301,7 +301,7 @@ proc parseGlobalObjects(js: JsonNode): GlobalObjects =
 
 proc parseStatus*(js: JsonNode): Tweet =
   with e, js{"errors"}:
-    if e.getError == tweetNotFound:
+    if e.getError in {tweetNotFound, tweetUnavailable, tweetCensored}:
       return
 
   result = parseTweet(js, js{"card"})

+ 2 - 0
src/types.nim

@@ -47,6 +47,8 @@ type
     forbidden = 200
     badToken = 239
     noCsrf = 353
+    tweetUnavailable = 421
+    tweetCensored = 422
 
   User* = object
     id*: string