From fbc9061b2149686ff955504be6b7c100ef27b516 Mon Sep 17 00:00:00 2001 From: NoPlagiarism <37241775+NoPlagiarism@users.noreply.github.com> Date: Tue, 16 Aug 2022 02:30:08 +0500 Subject: [PATCH 1/2] vt.tiktok.com + tiktok.com/t support --- 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 395ed42..a3482a4 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\.tiktok\.com/([A-Za-z0-9]+)%', $url, $m)) { + if (preg_match('%^https://(?: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)) { 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 2/2] 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)) {