[dw] add support for audio pages
This commit is contained in:
parent
c8868a9d83
commit
91d6aafb48
1 changed files with 24 additions and 8 deletions
|
@ -7,7 +7,8 @@ from ..utils import int_or_none
|
||||||
|
|
||||||
class DWIE(InfoExtractor):
|
class DWIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?dw\.com/(?:[^/]+/)+av-(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?dw\.com/(?:[^/]+/)+av-(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
|
# video
|
||||||
'url': 'http://www.dw.com/en/intelligent-light/av-19112290',
|
'url': 'http://www.dw.com/en/intelligent-light/av-19112290',
|
||||||
'md5': '7372046e1815c5a534b43f3c3c36e6e9',
|
'md5': '7372046e1815c5a534b43f3c3c36e6e9',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
@ -17,21 +18,36 @@ class DWIE(InfoExtractor):
|
||||||
'description': 'md5:90e00d5881719f2a6a5827cb74985af1',
|
'description': 'md5:90e00d5881719f2a6a5827cb74985af1',
|
||||||
'upload_date': '20160311',
|
'upload_date': '20160311',
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
# audio
|
||||||
|
'url': 'http://www.dw.com/en/worldlink-my-business/av-19111941',
|
||||||
|
'md5': '2814c9a1321c3a51f8a7aeb067a360dd',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19111941',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'WorldLink: My business',
|
||||||
|
'description': 'md5:bc9ca6e4e063361e21c920c53af12405',
|
||||||
|
'upload_date': '20160311',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
formats = self._extract_smil_formats(
|
|
||||||
'http://www.dw.com/smil/v-%s' % video_id, video_id,
|
|
||||||
transform_source=lambda s: s.replace(
|
|
||||||
'rtmp://tv-od.dw.de/flash/',
|
|
||||||
'http://tv-download.dw.de/dwtv_video/flv/'))
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
hidden_inputs = self._hidden_inputs(webpage)
|
hidden_inputs = self._hidden_inputs(webpage)
|
||||||
title = hidden_inputs['media_title']
|
title = hidden_inputs['media_title']
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
if hidden_inputs.get('player_type') == 'video' and hidden_inputs.get('stream_file') == '1':
|
||||||
|
formats = self._extract_smil_formats(
|
||||||
|
'http://www.dw.com/smil/v-%s' % video_id, video_id,
|
||||||
|
transform_source=lambda s: s.replace(
|
||||||
|
'rtmp://tv-od.dw.de/flash/',
|
||||||
|
'http://tv-download.dw.de/dwtv_video/flv/'))
|
||||||
|
else:
|
||||||
|
formats = [{'url': hidden_inputs['file_name']}]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
|
|
Loading…
Reference in a new issue