mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 15:19:32 +00:00
parent
8114eefa19
commit
4e38317582
1 changed files with 7 additions and 3 deletions
|
|
@ -6,6 +6,10 @@ import experimental/parser/unifiedcard
|
||||||
|
|
||||||
proc parseGraphTweet(js: JsonNode): Tweet
|
proc parseGraphTweet(js: JsonNode): Tweet
|
||||||
|
|
||||||
|
proc parseVerifiedType(s: string; current: VerifiedType): VerifiedType =
|
||||||
|
try: parseEnum[VerifiedType](s)
|
||||||
|
except ValueError: current
|
||||||
|
|
||||||
proc parseCommunityNote(js: JsonNode): string =
|
proc parseCommunityNote(js: JsonNode): string =
|
||||||
let subtitle = js{"subtitle"}
|
let subtitle = js{"subtitle"}
|
||||||
result = subtitle{"text"}.getStr
|
result = subtitle{"text"}.getStr
|
||||||
|
|
@ -35,7 +39,7 @@ proc parseUser(js: JsonNode; id=""): User =
|
||||||
result.verifiedType = blue
|
result.verifiedType = blue
|
||||||
|
|
||||||
with verifiedType, js{"verified_type"}:
|
with verifiedType, js{"verified_type"}:
|
||||||
result.verifiedType = parseEnum[VerifiedType](verifiedType.getStr)
|
result.verifiedType = parseVerifiedType(verifiedType.getStr, result.verifiedType)
|
||||||
|
|
||||||
result.expandUserEntities(js)
|
result.expandUserEntities(js)
|
||||||
|
|
||||||
|
|
@ -66,7 +70,7 @@ proc parseGraphUser(js: JsonNode): User =
|
||||||
result.verifiedType = blue
|
result.verifiedType = blue
|
||||||
|
|
||||||
with verifiedType, user{"verification", "verified_type"}:
|
with verifiedType, user{"verification", "verified_type"}:
|
||||||
result.verifiedType = parseEnum[VerifiedType](verifiedType.getStr)
|
result.verifiedType = parseVerifiedType(verifiedType.getStr, result.verifiedType)
|
||||||
|
|
||||||
proc parseAboutAccount*(js: JsonNode): AccountInfo =
|
proc parseAboutAccount*(js: JsonNode): AccountInfo =
|
||||||
if js.isNull: return
|
if js.isNull: return
|
||||||
|
|
@ -88,7 +92,7 @@ proc parseAboutAccount*(js: JsonNode): AccountInfo =
|
||||||
if user{"is_blue_verified"}.getBool(false):
|
if user{"is_blue_verified"}.getBool(false):
|
||||||
result.verifiedType = blue
|
result.verifiedType = blue
|
||||||
with verifiedType, user{"verification", "verified_type"}:
|
with verifiedType, user{"verification", "verified_type"}:
|
||||||
result.verifiedType = parseEnum[VerifiedType](verifiedType.getStr)
|
result.verifiedType = parseVerifiedType(verifiedType.getStr, result.verifiedType)
|
||||||
|
|
||||||
with about, user{"about_profile"}:
|
with about, user{"about_profile"}:
|
||||||
result.basedIn = about{"account_based_in"}.getStr
|
result.basedIn = about{"account_based_in"}.getStr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue