Only strip quote links

This commit is contained in:
Zed 2019-06-24 09:39:45 +02:00
parent e07a8d04b4
commit e920e98d10

View file

@ -39,11 +39,13 @@ proc getUsername*(profile: XmlNode; selector: string): string =
profile.selectText(selector).strip(chars={'@', ' '})
proc getTweetText*(tweet: XmlNode): string =
let selector = ".tweet-text > a.twitter-timeline-link.u-hidden"
let link = tweet.selectAttr(selector, "data-expanded-url")
var text = tweet.selectText(".tweet-text")
let
selector = ".tweet-text > a.twitter-timeline-link.u-hidden"
link = tweet.selectAttr(selector, "data-expanded-url")
quote = tweet.querySelector(".QuoteTweet")
if link.len > 0 and link in text:
if not quote.isNil and link.len > 0:
text = text.replace(link, "")
stripTwitterUrls(text)