[fktv] fix info extraction
This commit is contained in:
parent
0f206ee814
commit
e0f06eae43
1 changed files with 13 additions and 17 deletions
|
@ -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:
|
|
||||||
raise ExtractorError('Unable to extract the video')
|
|
||||||
|
|
||||||
poster, sources = matches.groups()
|
formats = []
|
||||||
if poster is None:
|
for source in sources:
|
||||||
self.report_warning('unable to extract thumbnail')
|
furl = source.get('src')
|
||||||
|
if furl:
|
||||||
urls = re.findall(r'<source[^>]+src="([^"]+)"', sources)
|
formats.append({
|
||||||
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…
Reference in a new issue