1
0
mirror of https://github.com/zedeus/nitter.git synced 2026-05-13 07:42:49 -04:00
This commit is contained in:
Zed
2025-11-17 11:01:20 +01:00
parent 886f2d2a45
commit 6b655cddd8
3 changed files with 1 additions and 57 deletions
-18
View File
@@ -72,21 +72,3 @@ proc parseHook*(s: string; i: var int; v: var User) =
var u: RawUser
parseHook(s, i, u)
v = toUser u
proc parseUser*(json: string; username=""): User =
handleErrors:
case error.code
of suspended: return User(username: username, suspended: true)
of userNotFound: return
else: echo "[error - parseUser]: ", error
result = json.fromJson(User)
proc parseUsers*(json: string; after=""): Result[User] =
result = Result[User](beginning: after.len == 0)
# starting with '{' means it's an error
if json[0] == '[':
let raw = json.fromJson(seq[RawUser])
for user in raw:
result.content.add user.toUser