[orf:tvthek] Improve extraction and remove unused code (closes #17956, closes #18024)

pull/8/head
Sergey M․ 6 years ago
parent c620694c97
commit 4b6aca17cc
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

@ -15,6 +15,7 @@ from ..utils import (
strip_jsonp, strip_jsonp,
unescapeHTML, unescapeHTML,
unified_strdate, unified_strdate,
url_or_none,
) )
@ -68,12 +69,6 @@ class ORFTVthekIE(InfoExtractor):
webpage, 'playlist', group='json'), webpage, 'playlist', group='json'),
playlist_id, transform_source=unescapeHTML)['playlist']['videos'] playlist_id, transform_source=unescapeHTML)['playlist']['videos']
def quality_to_int(s):
m = re.search('([0-9]+)', s)
if m is None:
return -1
return int(m.group(1))
entries = [] entries = []
for sd in data_jsb: for sd in data_jsb:
video_id, title = sd.get('id'), sd.get('title') video_id, title = sd.get('id'), sd.get('title')
@ -82,14 +77,27 @@ class ORFTVthekIE(InfoExtractor):
video_id = compat_str(video_id) video_id = compat_str(video_id)
formats = [] formats = []
for fd in sd['sources']: for fd in sd['sources']:
format_id = '%s-%s-%s' % ( src = url_or_none(fd.get('src'))
fd['delivery'], fd['quality'], fd['quality_string']) if not src:
continue
format_id_list = []
for key in ('delivery', 'quality', 'quality_string'):
value = fd.get(key)
if value:
format_id_list.append(value)
format_id = '-'.join(format_id_list)
if determine_ext(fd['src']) == 'm3u8': if determine_ext(fd['src']) == 'm3u8':
formats.extend(self._extract_m3u8_formats( formats.extend(self._extract_m3u8_formats(
fd['src'], video_id, 'mp4', m3u8_id=format_id)) fd['src'], video_id, 'mp4', m3u8_id=format_id))
elif determine_ext(fd['src']) == 'f4m': elif determine_ext(fd['src']) == 'f4m':
formats.extend(self._extract_f4m_formats( formats.extend(self._extract_f4m_formats(
fd['src'], video_id, f4m_id=format_id)) fd['src'], video_id, f4m_id=format_id))
else:
formats.append({
'format_id': format_id,
'url': src,
'protocol': fd.get('protocol'),
})
# Check for geoblocking. # Check for geoblocking.
# There is a property is_geoprotection, but that's always false # There is a property is_geoprotection, but that's always false

Loading…
Cancel
Save