[fktv] fix info extraction

pull/8/head
remitamine 9 years ago
parent 0f206ee814
commit e0f06eae43

@ -1,12 +1,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
clean_html, clean_html,
determine_ext, determine_ext,
ExtractorError, js_to_json,
) )
@ -32,24 +30,22 @@ class FKTVIE(InfoExtractor):
'http://fernsehkritik.tv/folge-%s/play' % episode, episode) 'http://fernsehkritik.tv/folge-%s/play' % episode, episode)
title = clean_html(self._html_search_regex( title = clean_html(self._html_search_regex(
'<h3>([^<]+)</h3>', webpage, 'title')) '<h3>([^<]+)</h3>', webpage, 'title'))
matches = re.search( thumbnail = self._search_regex(r'POSTER\s*=\s*"([^"]+)', webpage, 'thumbnail', fatal=False)
r'(?s)<video(?:(?!poster)[^>])+(?:poster="([^"]+)")?[^>]*>(.*)</video>', sources = self._parse_json(self._search_regex(r'(?s)MEDIA\s*=\s*(\[.+?\]);', webpage, 'media'), episode, js_to_json)
webpage)
if matches is None: formats = []
raise ExtractorError('Unable to extract the video') for source in sources:
furl = source.get('src')
poster, sources = matches.groups() if furl:
if poster is None: formats.append({
self.report_warning('unable to extract thumbnail')
urls = re.findall(r'<source[^>]+src="([^"]+)"', sources)
formats = [{
'url': furl, 'url': furl,
'format_id': determine_ext(furl), 'format_id': determine_ext(furl),
} for furl in urls] })
self._sort_formats(formats)
return { return {
'id': episode, 'id': episode,
'title': title, 'title': title,
'formats': formats, 'formats': formats,
'thumbnail': poster, 'thumbnail': thumbnail,
} }

Loading…
Cancel
Save