From e8252729871cd10f8826b5635da23aafd86b7d0c Mon Sep 17 00:00:00 2001 From: Dag Date: Thu, 2 Jan 2025 18:22:47 +0100 Subject: [PATCH] fix(rumble): exterminate double leading slashes in item url (#4381) Fixed for items with pub date newer than 31. jan 2025 --- bridges/RumbleBridge.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bridges/RumbleBridge.php b/bridges/RumbleBridge.php index 8d92db3bb70..11755b51420 100644 --- a/bridges/RumbleBridge.php +++ b/bridges/RumbleBridge.php @@ -60,15 +60,10 @@ public function collectData() $dom = getSimpleHTMLDOM($url); foreach ($dom->find('ol.thumbnail__grid div.thumbnail__grid--item') as $video) { - $itemUrlString = self::URI . $video->find('a', 0)->href; - $itemUrl = Url::fromString($itemUrlString); + $href = $video->find('a', 0)->href; $item = [ 'title' => $video->find('h3', 0)->plaintext, - - // Remove tracking parameter in query string - 'uri' => $itemUrl->withQueryString(null)->__toString(), - 'author' => $account . '@rumble.com', 'content' => defaultLinkTo($video, self::URI)->innertext, ]; @@ -78,6 +73,14 @@ public function collectData() $publishedAt = new \DateTimeImmutable($time->getAttribute('datetime')); $item['timestamp'] = $publishedAt->getTimestamp(); } + + if (isset($publishedAt) && $publishedAt > new \DateTimeImmutable('2025-01-31')) { + $href = ltrim($href, '/'); + } + $itemUrl = Url::fromString(self::URI . $href); + // Remove tracking parameter in query string + $item['uri'] = $itemUrl->withQueryString(null)->__toString(); + $this->items[] = $item; } }