diff --git a/internal/twitter/validate.go b/internal/twitter/validate.go index a6205de..cf43724 100644 --- a/internal/twitter/validate.go +++ b/internal/twitter/validate.go @@ -3,6 +3,7 @@ package twitter import ( "errors" "net/url" + "regexp" ) func EffectiveUrl(rawUrl string) (string, error) { @@ -18,5 +19,7 @@ func EffectiveUrl(rawUrl string) (string, error) { } uri.RawQuery = "" uri.Scheme = "https" + reTrimmer := regexp.MustCompile("/photo/[0-9]+$|/video/[0-9]+$|/retweets/with_comments$") + uri.Path = reTrimmer.ReplaceAllString(uri.Path, "") return "https://publish.twitter.com/oembed?url=" + uri.String(), nil }