diff --git a/bridges/TheDriveBridge.php b/bridges/TheDriveBridge.php new file mode 100644 index 00000000000..f164dccd36e --- /dev/null +++ b/bridges/TheDriveBridge.php @@ -0,0 +1,45 @@ +collectExpandableDatas('https://www.thedrive.com/feed', 20); + } + + protected function parseItem($feedItem) + { + $item = parent::parseItem($feedItem); + + //remove warzone articles + if (str_contains($item['uri'], 'the-war-zone')) { + return null; + } + + //the first image in the article is an attachment for some reason + foreach ($item['enclosures'] as $attachment) { + $item['content'] = '' . $item['content']; + } + $item['enclosures'] = []; + + //make youtube videos clickable + $html = str_get_html($item['content']); + + foreach ($html->find('div.lazied-youtube-frame') as $youtubeVideoDiv) { + $videoID = $youtubeVideoDiv->getAttribute('data-video-id'); + + //place around the
+ $youtubeVideoDiv->outertext = '' . $youtubeVideoDiv->outertext . ''; + } + + $item['content'] = $html; + + return $item; + } +}