From aa2fff2b31f4a19f855578ca5c26c3227c5d00cf Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Tue, 16 Aug 2022 03:03:48 +0500 Subject: [PATCH] www, http, + /t/ fix --- app/Controllers/RedirectController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/RedirectController.php b/app/Controllers/RedirectController.php index a3482a4..2f7158a 100644 --- a/app/Controllers/RedirectController.php +++ b/app/Controllers/RedirectController.php @@ -52,7 +52,7 @@ class RedirectController { * to_endpoint maps a TikTok URL into a ProxiTok-compatible endpoint URL. */ static private function to_endpoint(string $url): string { - if (preg_match('%^https://(?:vm|vt)+\.tiktok\.com/(?:t/)([A-Za-z0-9]+)%', $url, $m)) { + if (preg_match('%^(?:https?://|www\.)?(?:vm\.|vt\.)?tiktok\.com/(?:t/)?([A-Za-z0-9]+)%', $url, $m)) { // Short video URL return '/@placeholder/video/' . $m[1]; } elseif (preg_match('%^https://www\.tiktok\.com/(.+)%', $url, $m)) {