- mobj = re.match(self._VALID_URL, url)
- channel_id = mobj.group('id')
- alias = mobj.group('alias')
-
- headers = self._make_headers(url)
-
- video = None
-
- # Id-based channels are currently broken on their side: webplayer
- # tries to process them via byChannelAlias endpoint and fails
- # predictably.
- for page_num in itertools.count():
- by_channel_alias = self._download_json(
- 'https://www.funk.net/api/v3.1/webapp/videos/byChannelAlias/%s'
- % channel_id,
- 'Downloading byChannelAlias JSON page %d' % (page_num + 1),
- headers=headers, query={
- 'filterFsk': 'false',
- 'sort': 'creationDate,desc',
- 'size': 100,
- 'page': page_num,
- }, fatal=False)
- if not by_channel_alias:
- break
- video_list = try_get(
- by_channel_alias, lambda x: x['_embedded']['videoList'], list)
- if not video_list:
- break
- try:
- video = next(r for r in video_list if r.get('alias') == alias)
- break
- except StopIteration:
- pass
- if not try_get(
- by_channel_alias, lambda x: x['_links']['next']):
- break
-
- if not video:
- by_id_list = self._download_json(
- 'https://www.funk.net/api/v3.0/content/videos/byIdList',
- channel_id, 'Downloading byIdList JSON', headers=headers,
- query={
- 'ids': alias,
- }, fatal=False)
- if by_id_list:
- video = try_get(by_id_list, lambda x: x['result'][0], dict)
-
- if not video:
- results = self._download_json(
- 'https://www.funk.net/api/v3.0/content/videos/filter',
- channel_id, 'Downloading filter JSON', headers=headers, query={
- 'channelId': channel_id,
- 'size': 100,
- })['result']
- video = next(r for r in results if r.get('alias') == alias)
-
- return self._make_url_result(video)
+ display_id, nexx_id = re.match(self._VALID_URL, url).groups()
+ video = self._download_json(
+ 'https://www.funk.net/api/v4.0/videos/' + nexx_id, nexx_id)
+ return {
+ '_type': 'url_transparent',
+ 'url': 'nexx:741:' + nexx_id,
+ 'ie_key': NexxIE.ie_key(),
+ 'id': nexx_id,
+ 'title': video.get('title'),
+ 'description': video.get('description'),
+ 'duration': int_or_none(video.get('duration')),
+ 'channel_id': str_or_none(video.get('channelId')),
+ 'display_id': display_id,
+ 'tags': video.get('tags'),
+ 'thumbnail': video.get('imageUrlLandscape'),
+ }