Fix video links
This commit is contained in:
parent
7483695979
commit
f8d05eb115
1 changed files with 1 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ func FetchTweets(user string, last string) ([]*Tweet, error) {
|
||||||
s.Find(".PlayableMedia-player").Each(func(i int, v *goquery.Selection) {
|
s.Find(".PlayableMedia-player").Each(func(i int, v *goquery.Selection) {
|
||||||
if style, ok := v.Attr("style"); ok {
|
if style, ok := v.Attr("style"); ok {
|
||||||
if strings.Contains(style, "background") {
|
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 {
|
if len(match) == 2 {
|
||||||
tweet.Videos = append(tweet.Videos, Video{ID: match[1], Preview: match[0]})
|
tweet.Videos = append(tweet.Videos, Video{ID: match[1], Preview: match[0]})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue