- video_id = self._match_id(url)
- webpage = self._download_webpage(url, video_id)
-
- error_message = self._html_search_regex(
- r'<div class="message-error">(.+?)</div>',
- webpage, 'error message', default=None)
- if error_message:
- raise ExtractorError(
- '%s returned error: %s' % (self.IE_NAME, error_message), expected=True)
-
- real_url = self._html_search_regex(
- r'\"fsk-button\".+?href=\"([^"]+)',
- webpage, 'fsk_button', default=None)
- if real_url:
- webpage = self._download_webpage(real_url, video_id)
-
- player = self._search_regex(
- r'p4_video_player(?:_iframe)?\("video_\d+_container"\s*,(.+?)\);\s*\}',
- webpage, 'player')
-
- player_json = self._parse_json(
- '[%s]' % player, video_id,
- transform_source=lambda s: s.replace('undefined,', ''))
-
- formats = None
- result = None
-
- for v in player_json:
- if isinstance(v, list) and not formats:
- formats = [{
- 'url': f['url'],
- 'format': 'hd' if f.get('hd') else 'sd',
- 'width': int_or_none(f.get('size_x')),
- 'height': int_or_none(f.get('size_y')),
- 'tbr': int_or_none(f.get('bitrate')),
- } for f in v]
- self._sort_formats(formats)
- elif isinstance(v, dict) and not result:
- result = {
- 'id': video_id,
- 'title': v['videopartname'].strip(),
- 'description': v.get('videotitle'),
- 'duration': int_or_none(v.get('videoduration') or v.get('episodeduration')),
- 'upload_date': unified_strdate(v.get('clipreleasetime')),
- 'uploader': v.get('channel'),
- }
-
- result['formats'] = formats
-
- return result
+ path = self._match_id(url)
+ content_path = self._download_json(
+ 'http://www.puls4.com/api/json-fe/page/' + path, path)['content'][0]['url']
+ media = self._download_json(
+ 'http://www.puls4.com' + content_path,
+ content_path)['mediaCurrent']
+ player_content = media['playerContent']
+ info = self._extract_video_info(url, player_content['id'])
+ info.update({
+ 'id': compat_str(media['objectId']),
+ 'title': player_content['title'],
+ 'description': media.get('description'),
+ 'thumbnail': media.get('previewLink'),
+ 'upload_date': unified_strdate(media.get('date')),
+ 'duration': parse_duration(player_content.get('duration')),
+ 'episode': player_content.get('episodePartName'),
+ 'show': media.get('channel'),
+ 'season_id': player_content.get('seasonId'),
+ 'uploader': player_content.get('sourceCompany'),
+ })
+ return info