From c5cffefae17e90141c9ec1e9ef7847c6177ba273 Mon Sep 17 00:00:00 2001 From: tolantop <> Date: Wed, 4 Mar 2020 01:53:13 +0300 Subject: [PATCH] add: detect pin post --- tweets.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tweets.go b/tweets.go index c50705e..4cf5e42 100644 --- a/tweets.go +++ b/tweets.go @@ -24,6 +24,7 @@ type Tweet struct { Hashtags []string HTML string ID string + IsPin bool IsRetweet bool Likes int PermanentURL string @@ -112,6 +113,9 @@ func FetchTweets(user string, last string) ([]*Tweet, error) { s.Find(".js-retweet-text, .QuoteTweet").Each(func(i int, c *goquery.Selection) { tweet.IsRetweet = true }) + s.Find(`span[class="js-pinned-text"]`).Each(func(i int, c *goquery.Selection) { + tweet.IsPin = true + }) s.Find(".ProfileTweet-actionCount").Each(func(i int, c *goquery.Selection) { txt := strings.TrimSpace(c.Text()) if strings.HasSuffix(txt, "likes") {