Fix crash caused by "withheld" tweets
This commit is contained in:
parent
d05fbd085f
commit
1e73a2f8bf
1 changed files with 3 additions and 2 deletions
|
@ -79,7 +79,8 @@ proc parseQuote*(quote: XmlNode): Quote =
|
||||||
|
|
||||||
proc parseTweet*(node: XmlNode): Tweet =
|
proc parseTweet*(node: XmlNode): Tweet =
|
||||||
let tweet = node.select(".tweet")
|
let tweet = node.select(".tweet")
|
||||||
if tweet == nil: return Tweet()
|
if tweet == nil or "withheld-tweet" in tweet.attr("class"):
|
||||||
|
return Tweet()
|
||||||
|
|
||||||
result = Tweet(
|
result = Tweet(
|
||||||
id: tweet.attr("data-item-id"),
|
id: tweet.attr("data-item-id"),
|
||||||
|
@ -119,7 +120,7 @@ proc parseThread*(nodes: XmlNode): Thread =
|
||||||
result = Thread()
|
result = Thread()
|
||||||
for n in nodes.filterIt(it.kind != xnText):
|
for n in nodes.filterIt(it.kind != xnText):
|
||||||
let class = n.attr("class").toLower()
|
let class = n.attr("class").toLower()
|
||||||
if "tombstone" in class or "unavailable" in class:
|
if "tombstone" in class or "unavailable" in class or "withheld" in class:
|
||||||
result.tweets.add Tweet()
|
result.tweets.add Tweet()
|
||||||
elif "morereplies" in class:
|
elif "morereplies" in class:
|
||||||
result.more = getMoreReplies(n)
|
result.more = getMoreReplies(n)
|
||||||
|
|
Loading…
Reference in a new issue