diff --git a/bridges/RedditBridge.php b/bridges/RedditBridge.php index 03f279d8..2a3824f4 100644 --- a/bridges/RedditBridge.php +++ b/bridges/RedditBridge.php @@ -234,11 +234,14 @@ class RedditBridge extends BridgeAbstract } elseif ($data->is_video) { // Video - // Higher index -> Higher resolution - end($data->preview->images[0]->resolutions); - $index = key($data->preview->images[0]->resolutions); - - $item['content'] = $this->createFigureLink($data->url, $data->preview->images[0]->resolutions[$index]->url, 'Video'); + if ($data->media->reddit_video) { + $item['content'] = $this->createVideoContent($data->media->reddit_video); + } else { + // Higher index -> Higher resolution + end($data->preview->images[0]->resolutions); + $index = key($data->preview->images[0]->resolutions); + $item['content'] = $this->createFigureLink($data->url, $data->preview->images[0]->resolutions[$index]->url, 'Video'); + } } elseif (isset($data->media) && $data->media->type == 'youtube.com') { // Youtube link $item['content'] = $this->createFigureLink($data->url, $data->media->oembed->thumbnail_url, 'YouTube'); @@ -318,6 +321,16 @@ class RedditBridge extends BridgeAbstract return sprintf('%s', $href, $text); } + private function createVideoContent(\stdClass $video): string + { + return << + + Your browser does not support the video tag. + + HTML; + } + public function detectParameters($url) { try {