diff --git a/src/api.nim b/src/api.nim index 52aec12..44799d3 100644 --- a/src/api.nim +++ b/src/api.nim @@ -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) diff --git a/src/views/user.nimf b/src/views/user.nimf index a85c7cb..fec0b80 100644 --- a/src/views/user.nimf +++ b/src/views/user.nimf @@ -53,6 +53,7 @@ #end proc # #proc renderTimeline*(timeline: Timeline; profile: Profile; beginning: bool): string = +#var retweets: Tweets
Only confirmed followers have access to @${profile.username}'s Tweets.