diff --git a/main.go b/main.go index 25c4759..1ef692a 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ type NostrClient struct { } var ( - TwitterUrlRegexp = regexp.MustCompile(`^(?:https?:\/\/)?((www\.)?(twitter|x)\.com)\/`) + TwitterUrlRegexp = regexp.MustCompile(`(?:https?:\/\/)?(?:www\.)?((?:twitter|x)\.com)\/\w+\/status(?:es)?\/\d+`) // references: // - https://github.com/zedeus/nitter/wiki/Instances // - https://status.d420.de/ @@ -57,9 +57,9 @@ func main() { var comment string if m = TwitterUrlRegexp.FindStringSubmatch(item.Url); m != nil { - comment = strings.Replace(item.Url, m[1], "xcancel.com", 1) + comment = strings.Replace(m[0], m[1], "xcancel.com", 1) } else if m = TwitterUrlRegexp.FindStringSubmatch(item.Text); m != nil { - comment = strings.Replace(item.Text, m[1], "xcancel.com", 1) + comment = strings.Replace(m[0], m[1], "xcancel.com", 1) } if comment != "" {