[ 'name' => 'Show Link or ID', 'required' => true, 'title' => 'Link to the show page or just its alphanumeric suffix', 'defaultValue' => 'https://www.ardmediathek.de/sendung/45-min/Y3JpZDovL25kci5kZS8xMzkx/' ] ] ]; public function collectData() { $oldTz = date_default_timezone_get(); date_default_timezone_set('Europe/Berlin'); $pathComponents = explode('/', $this->getInput('path')); if (empty($pathComponents)) { returnClientError('Path may not be empty'); } if (count($pathComponents) < 2) { $showID = $pathComponents[0]; } else { $lastKey = count($pathComponents) - 1; $showID = $pathComponents[$lastKey]; if (strlen($showID) === 0) { $showID = $pathComponents[$lastKey - 1]; } } $url = self::APIENDPOINT . $showID . '/?pageSize=' . self::PAGESIZE; $rawJSON = getContents($url); $processedJSON = json_decode($rawJSON); foreach ($processedJSON->teasers as $video) { $item = []; // there is also ->links->self->id, ->links->self->urlId, ->links->target->id, ->links->target->urlId $item['uri'] = self::VIDEOLINKPREFIX . $video->id . '/'; // there is also ->mediumTitle and ->shortTitle $item['title'] = $video->longTitle; // in the test, aspect16x9 was the only child of images, not sure whether that is always true $item['enclosures'] = [ str_replace(self::IMAGEWIDTHPLACEHOLDER, self::IMAGEWIDTH, $video->images->aspect16x9->src) ]; $item['content'] = '

'; $item['timestamp'] = $video->broadcastedOn; $item['uid'] = $video->id; $item['author'] = $video->publicationService->name; $this->items[] = $item; } date_default_timezone_set($oldTz); } }