diff --git a/bridges/PlaySrfBridge.php b/bridges/PlaySrfBridge.php index e603c22673c..7d5b4002ce0 100644 --- a/bridges/PlaySrfBridge.php +++ b/bridges/PlaySrfBridge.php @@ -4,14 +4,14 @@ class PlaySrfBridge extends BridgeAbstract { - const NAME = 'Play SRF'; + const NAME = 'Play SRF / RTS / RSI / RTR'; const URI = 'https://www.srf.ch/play/tv'; - const DESCRIPTION = 'Feed of any show in the Play SRF portal, specified by its ID'; + const DESCRIPTION = 'Feed of any show in the Play SRF / RTS / RSI / RTR portals, specified by its ID'; const MAINTAINER = 'giodi'; const PARAMETERS = [ [ 'showId' => [ - 'name' => 'Show Link or ID', + 'name' => 'URL of Show Page', 'required' => true, 'title' => 'Insert the URL to the page of a show.', 'exampleValue' => 'https://www.srf.ch/play/tv/sendung/arena?id=09784065-687b-4b60-bd23-9ed0d2d43cdc' @@ -35,14 +35,15 @@ class PlaySrfBridge extends BridgeAbstract public function collectData(): void { - preg_match('/[a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12}$/s', $this->getInput('showId'), $matches); - $url = $matches[0]; + preg_match('/[a-z0-9]{8}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12}$|[0-9]{5,10}$/s', $this->getInput('showId'), $matchShowId); + preg_match('/(?<=https:\/{2}w{3}\.)[first]{3}/', $this->getInput('showId'), $matchRegion); + $showId = $matchShowId[0]; + $region = $matchRegion[0]; $embed = $this->getInput('embed'); $limit = $this->getInput('limit'); - $raw = getContents('https://www.srf.ch/play/v3/api/srf/production/videos-by-show-id?showId=' . $url); + $raw = getContents('https://www.' . $region . '.ch/play/v3/api/' . $region . '/production/videos-by-show-id?showId=' . $showId); $jsonShowVideos = json_decode($raw, true); - $this->title = $jsonShowVideos['data']['data'][0]['show']['title'] ?? 'Play SRF'; $episodes = $jsonShowVideos['data']['data']; @@ -56,7 +57,7 @@ public function collectData(): void if ($embed === true) { $content .= '