update regex, switch to tnktok.com
Marco Andronaco andronacomarco@gmail.com
Thu, 29 Feb 2024 10:37:10 +0100
1 files changed,
12 insertions(+),
9 deletions(-)
jump to
M
telegram/replace.go
→
telegram/replace.go
@@ -12,16 +12,19 @@ Regex *regexp.Regexp
Format string } -var parseMode = "markdown" -var linkMessage = "[🔗](%s) Da %s." -var regexFlags = "(?i)(?m)" +const ( + parseMode = "markdown" + linkMessage = "[🔗](%s) Da %s." + regexFlags = "(?i)(?m)" +) + var replacers = []Replacer{ { Regex: regexp.MustCompile(regexFlags + `(?:(?:https?:)?\/\/)?(?:(?:www|m)\.)?(?:(?:youtube(?:-nocookie)?\.com|youtu.be))(?:\/(?:[\w\-]+\?v=|embed\/|live\/|v\/|shorts\/)?)([\w\-]+)`), Format: "https://y.outube.duckdns.org/%s", }, { - Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)(?:www\.)?twitter\.com\/(?:#!\/)?(.*)\/status(?:es)?\/([^\/\?\s]+)`), + Regex: regexp.MustCompile(regexFlags + `https?:\/\/(?:www\.)?twitter\.com\/(?:#!\/)?(.*)\/status(?:es)?\/([^\/\?\s]+)`), Format: "https://fxtwitter.com/%s/status/%s", }, {@@ -29,16 +32,16 @@ Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:www\.)?x\.com\/(?:#!\/)?(.*)\/status(?:es)?\/([^\/\?\s]+)`),
Format: "https://fixupx.com/%s/status/%s", }, { - Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:www\.)?instagram\.com\/(reel|p)\/([A-Za-z0-9_-]{11})[\/\?\w=&]*`), + Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:www\.)?instagram\.com\/(reels?|p)\/([\w\-]{11})[\/\?\w=&]*`), Format: "https://ddinstagram.com/%s/%s", }, { - Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:(?:www)|(?:vm))?\.?tiktok\.com\/@([\w\d_.]+)\/(?:video)\/(\d+)`), - Format: "https://www.vxtiktok.com/@%s/video/%s", + Regex: regexp.MustCompile(regexFlags + `https?:\/\/(?:(?:www)|(?:vm))?\.?tiktok\.com\/@([\w.]+)\/(?:video)\/(\d{19,})`), + Format: "https://www.tnktok.com/@%s/video/%s", }, { - Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:(?:www)|(?:vm))?\.?tiktok\.com\/([\w]+)\/?`), - Format: "https://vm.vxtiktok.com/%s/", + Regex: regexp.MustCompile(regexFlags + `(?:https?:\/\/)?(?:(?:www)|(?:vm))?\.?tiktok\.com\/(?:t\/)?([\w]{9})\/?`), + Format: "https://vm.tnktok.com/%s/", }, }