mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Use Karax html rendering instead of source filters (#2)
* Use Karax html rendering instead of source filters
This commit is contained in:
parent
fad2575d93
commit
ab36664ad2
21 changed files with 482 additions and 507 deletions
|
|
@ -238,14 +238,15 @@ proc getTweet*(username, id: string): Future[Conversation] {.async.} =
|
|||
let pollFut = getConversationPolls(result)
|
||||
await all(vidsFut, pollFut)
|
||||
|
||||
proc finishTimeline(json: JsonNode; query: Option[Query]): Future[Timeline] {.async.} =
|
||||
proc finishTimeline(json: JsonNode; query: Option[Query]; after: string): Future[Timeline] {.async.} =
|
||||
if json == nil: return Timeline()
|
||||
|
||||
result = Timeline(
|
||||
hasMore: json["has_more_items"].to(bool),
|
||||
maxId: json.getOrDefault("max_position").getStr(""),
|
||||
minId: json.getOrDefault("min_position").getStr("").cleanPos(),
|
||||
query: query
|
||||
query: query,
|
||||
beginning: after.len == 0
|
||||
)
|
||||
|
||||
if json["new_latent_count"].to(int) == 0: return
|
||||
|
|
@ -281,7 +282,7 @@ proc getTimeline*(username, after: string): Future[Timeline] {.async.} =
|
|||
params.add {"max_position": after}
|
||||
|
||||
let json = await fetchJson(base / (timelineUrl % username) ? params, headers)
|
||||
result = await finishTimeline(json, none(Query))
|
||||
result = await finishTimeline(json, none(Query), after)
|
||||
|
||||
proc getTimelineSearch*(username, after: string; query: Query): Future[Timeline] {.async.} =
|
||||
let queryParam = genQueryParam(query)
|
||||
|
|
@ -308,4 +309,4 @@ proc getTimelineSearch*(username, after: string; query: Query): Future[Timeline]
|
|||
}
|
||||
|
||||
let json = await fetchJson(base / timelineSearchUrl ? params, headers)
|
||||
result = await finishTimeline(json, some(query))
|
||||
result = await finishTimeline(json, some(query), after)
|
||||
|
|
|
|||
Loading…
Reference in a new issue