From f8d05eb11540d76cd6826ebe0f333ecdbf3fe56c Mon Sep 17 00:00:00 2001 From: Alexander Sheiko Date: Tue, 11 Feb 2020 16:56:00 +0200 Subject: [PATCH] Fix video links --- tweets.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tweets.go b/tweets.go index 05d0644..c08e1d2 100644 --- a/tweets.go +++ b/tweets.go @@ -150,7 +150,7 @@ func FetchTweets(user string, last string) ([]*Tweet, error) { s.Find(".PlayableMedia-player").Each(func(i int, v *goquery.Selection) { if style, ok := v.Attr("style"); ok { if strings.Contains(style, "background") { - match := regexp.MustCompile(`https:\/\/.+\/(\w+)\.jpg`).FindStringSubmatch(style) + match := regexp.MustCompile(`https:\/\/.+\/([\w-]+)\.(?:jpg|png)`).FindStringSubmatch(style) if len(match) == 2 { tweet.Videos = append(tweet.Videos, Video{ID: match[1], Preview: match[0]}) }