mirror of
https://github.com/zedeus/nitter
synced 2026-09-06 07:09:31 +00:00
Fix crash on protected profiles
This commit is contained in:
parent
8000a814df
commit
a3285e8410
2 changed files with 12 additions and 8 deletions
|
|
@ -49,11 +49,10 @@ proc fetchJson(url: Uri; headers: HttpHeaders): Future[JsonNode] {.async.} =
|
|||
var resp = ""
|
||||
try:
|
||||
resp = await client.getContent($url)
|
||||
result = parseJson(resp)
|
||||
except:
|
||||
return nil
|
||||
|
||||
return parseJson(resp)
|
||||
|
||||
proc getGuestToken(): Future[string] {.async.} =
|
||||
if getTime() - tokenUpdated < tokenLifetime:
|
||||
return token
|
||||
|
|
@ -166,7 +165,7 @@ proc getTimeline*(username: string; after=""): Future[Timeline] {.async.} =
|
|||
url &= "&max_position=" & cleanAfter
|
||||
|
||||
let json = await fetchJson(base / url, headers)
|
||||
let html = parseHtml(json["items_html"].to(string))
|
||||
if json.isNil: return Timeline()
|
||||
|
||||
result = Timeline(
|
||||
hasMore: json["has_more_items"].to(bool),
|
||||
|
|
@ -177,6 +176,7 @@ proc getTimeline*(username: string; after=""): Future[Timeline] {.async.} =
|
|||
if json["new_latent_count"].to(int) == 0:
|
||||
return
|
||||
|
||||
let html = parseHtml(json["items_html"].to(string))
|
||||
result.tweets = parseTweets(html)
|
||||
await getVideos(result.tweets)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue