2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 preferences
= {'xl': 4, 'l': 3, 'm': 2, 's': 1, 'xs': 0,}
14 class NDRBaseIE(InfoExtractor
):
15 def _real_extract(self
, url
):
16 video_id
= self
._match
_id
(url
)
18 json_data
= self
._download
_json
('http://www.ndr.de/%s-ppjson.json' % video_id
, video_id
, 'Downloading page')
21 objetType
= json_data
.get('config').get('objectType')
22 if objetType
== 'video':
23 for key
, f
in json_data
.get('playlist').items():
27 formats
.extend(self
._extract
_f
4m
_formats
(src
, video_id
))
29 formats
.extend(self
._extract
_m
3u8_formats
(src
, video_id
))
31 quality
= f
.get('quality')
35 'preference': preferences
.get(quality
),
37 elif objetType
== 'audio':
38 for key
, f
in json_data
.get('playlist').items():
46 raise ExtractorError('No media links available for %s' % video_id
)
48 self
._sort
_formats
(formats
)
50 config
= json_data
.get('playlist').get('config')
52 title
= config
['title']
53 duration
= int_or_none(config
.get('duration'))
55 'id': thumbnail
.get('quality'),
56 'url': thumbnail
.get('src'),
57 'preference': preferences
.get(thumbnail
.get('quality'))
58 } for thumbnail
in config
.get('poster').values()]
63 'thumbnails': thumbnails
,
69 class NDRIE(NDRBaseIE
):
71 IE_DESC
= 'NDR.de - Mediathek'
72 _VALID_URL
= r
'https?://www\.ndr\.de/.+?,(?P<id>\w+)\.html'
76 'url': 'http://www.ndr.de/fernsehen/sendungen/nordmagazin/Kartoffeltage-in-der-Lewitz,nordmagazin25866.html',
77 'md5': '5bc5f5b92c82c0f8b26cddca34f8bb2c',
80 'id': 'nordmagazin25866',
82 'title': 'Kartoffeltage in der Lewitz',
85 'skip': '404 Not found',
88 'url': 'http://www.ndr.de/fernsehen/Party-Poette-und-Parade,hafengeburtstag988.html',
89 'md5': 'dadc003c55ae12a5d2f6bd436cd73f59',
91 'id': 'hafengeburtstag988',
93 'title': 'Party, Pötte und Parade',
98 'url': 'http://www.ndr.de/info/La-Valette-entgeht-der-Hinrichtung,audio51535.html',
99 'md5': 'bb3cd38e24fbcc866d13b50ca59307b8',
100 'note': 'Audio file',
104 'title': 'La Valette entgeht der Hinrichtung',
111 class NJoyIE(NDRBaseIE
):
113 _VALID_URL
= r
'https?://www\.n-joy\.de/.+?,(?P<id>\w+)\.html'
116 'url': 'http://www.n-joy.de/entertainment/comedy/comedy_contest/Benaissa-beim-NDR-Comedy-Contest,comedycontest2480.html',
117 'md5': 'cb63be60cd6f9dd75218803146d8dc67',
121 'title': 'Benaissa beim NDR Comedy Contest',