mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-22 22:45:41 +00:00
Fix tweet tags being shown as unavailable tweets
This commit is contained in:
parent
e2039ec81c
commit
9dc4b240e7
|
@ -188,10 +188,11 @@ proc getTimeline*(username: string; after=""): Future[Timeline] {.async.} =
|
|||
minId: json.getOrDefault("min_position").getStr(""),
|
||||
)
|
||||
|
||||
if json["new_latent_count"].to(int) == 0:
|
||||
return
|
||||
if json["new_latent_count"].to(int) == 0: return
|
||||
if not json.hasKey("items_html"): return
|
||||
|
||||
let html = parseHtml(json["items_html"].to(string))
|
||||
|
||||
result.tweets = parseTweets(html)
|
||||
await getVideos(result.tweets)
|
||||
|
||||
|
|
|
@ -83,7 +83,9 @@ proc parseTweet*(node: XmlNode): Tweet =
|
|||
|
||||
proc parseTweets*(node: XmlNode): Tweets =
|
||||
if node == nil or node.kind == xnText: return
|
||||
node.selectAll(".stream-item").map(parseTweet)
|
||||
for n in node.selectAll(".stream-item"):
|
||||
if "account" notin n.child("div").attr("class"):
|
||||
result.add parseTweet(n)
|
||||
|
||||
proc parseConversation*(node: XmlNode): Conversation =
|
||||
result = Conversation(
|
||||
|
|
|
@ -140,8 +140,7 @@ proc getTweetMedia*(tweet: Tweet; node: XmlNode) =
|
|||
tweet.photos.add photo.attrs["data-image-url"]
|
||||
|
||||
let player = node.select(".PlayableMedia")
|
||||
if player == nil:
|
||||
return
|
||||
if player == nil: return
|
||||
|
||||
if "gif" in player.attr("class"):
|
||||
tweet.gif = some(getGif(player.select(".PlayableMedia-player")))
|
||||
|
@ -149,8 +148,7 @@ proc getTweetMedia*(tweet: Tweet; node: XmlNode) =
|
|||
tweet.video = some(Video())
|
||||
|
||||
proc getQuoteMedia*(quote: var Quote; node: XmlNode) =
|
||||
let sensitive = node.select(".QuoteTweet--sensitive")
|
||||
if sensitive != nil:
|
||||
if node.select(".QuoteTweet--sensitive") != nil:
|
||||
quote.sensitive = true
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in a new issue