From 0eb4f6b2678ab17255ee87bde2f919a7e6883799 Mon Sep 17 00:00:00 2001 From: Dag Date: Wed, 10 Jan 2024 20:39:15 +0100 Subject: [PATCH] fix(tiktok): remove duplicate leading slash in url path, fix #3884 (#3885) --- bridges/TikTokBridge.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bridges/TikTokBridge.php b/bridges/TikTokBridge.php index 6590df66808..22fdfcefdcc 100644 --- a/bridges/TikTokBridge.php +++ b/bridges/TikTokBridge.php @@ -35,21 +35,23 @@ public function collectData() foreach ($videos as $video) { $item = []; - // Handle link "untracking" - $linkParts = parse_url($video->find('a', 0)->href); - $link = $linkParts['scheme'] . '://' . $linkParts['host'] . '/' . $linkParts['path']; + // Omit query string (remove tracking parameters) + $a = $video->find('a', 0); + $href = $a->href; + $parsedUrl = parse_url($href); + $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/' . ltrim($parsedUrl['path'], '/'); $image = $video->find('video', 0)->poster; $views = $video->find('div[data-e2e=common-Video-Count]', 0)->plaintext; $enclosures = [$image]; - $item['uri'] = $link; + $item['uri'] = $url; $item['title'] = 'Video'; $item['author'] = '@' . $author; $item['enclosures'] = $enclosures; $item['content'] = << +

{$views} views


EOD;