[dw] Fix extractor

Closes #830
pull/905/head
pukkandan 3 years ago
parent 265a7a8ee5
commit d98b006b85

@ -5,6 +5,7 @@ from .common import InfoExtractor
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
unified_strdate, unified_strdate,
url_or_none,
) )
from ..compat import compat_urlparse from ..compat import compat_urlparse
@ -15,13 +16,13 @@ class DWIE(InfoExtractor):
_TESTS = [{ _TESTS = [{
# video # video
'url': 'http://www.dw.com/en/intelligent-light/av-19112290', 'url': 'http://www.dw.com/en/intelligent-light/av-19112290',
'md5': '7372046e1815c5a534b43f3c3c36e6e9', 'md5': 'fb9dfd9520811d3ece80f04befd73428',
'info_dict': { 'info_dict': {
'id': '19112290', 'id': '19112290',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Intelligent light', 'title': 'Intelligent light',
'description': 'md5:90e00d5881719f2a6a5827cb74985af1', 'description': 'md5:90e00d5881719f2a6a5827cb74985af1',
'upload_date': '20160311', 'upload_date': '20160605',
} }
}, { }, {
# audio # audio
@ -55,15 +56,16 @@ class DWIE(InfoExtractor):
title = hidden_inputs['media_title'] title = hidden_inputs['media_title']
media_id = hidden_inputs.get('media_id') or media_id media_id = hidden_inputs.get('media_id') or media_id
if hidden_inputs.get('player_type') == 'video' and hidden_inputs.get('stream_file') == '1': direct_url = url_or_none(hidden_inputs.get('file_name'))
if direct_url:
formats = [{'url': hidden_inputs['file_name']}]
else:
formats = self._extract_smil_formats( formats = self._extract_smil_formats(
'http://www.dw.com/smil/v-%s' % media_id, media_id, 'http://www.dw.com/smil/v-%s' % media_id, media_id,
transform_source=lambda s: s.replace( transform_source=lambda s: s.replace(
'rtmp://tv-od.dw.de/flash/', 'rtmp://tv-od.dw.de/flash/',
'http://tv-download.dw.de/dwtv_video/flv/')) 'http://tv-download.dw.de/dwtv_video/flv/'))
self._sort_formats(formats) self._sort_formats(formats)
else:
formats = [{'url': hidden_inputs['file_name']}]
upload_date = hidden_inputs.get('display_date') upload_date = hidden_inputs.get('display_date')
if not upload_date: if not upload_date:

Loading…
Cancel
Save