]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/swrmediathek.py
6d69f7686b37bd2b39b6362373eadefedef0b932
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import parse_duration
10 class SWRMediathekIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?swrmediathek\.de/(?:content/)?player\.htm\?show=(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})'
14 'url': 'http://swrmediathek.de/player.htm?show=849790d0-dab8-11e3-a953-0026b975f2e6',
15 'md5': '8c5f6f0172753368547ca8413a7768ac',
17 'id': '849790d0-dab8-11e3-a953-0026b975f2e6',
19 'title': 'SWR odysso',
20 'description': 'md5:2012e31baad36162e97ce9eb3f157b8a',
21 'thumbnail': 're:^http:.*\.jpg$',
23 'upload_date': '20140515',
24 'uploader': 'SWR Fernsehen',
25 'uploader_id': '990030',
28 'url': 'http://swrmediathek.de/player.htm?show=0e1a8510-ddf2-11e3-9be3-0026b975f2e6',
29 'md5': 'b10ab854f912eecc5a6b55cd6fc1f545',
31 'id': '0e1a8510-ddf2-11e3-9be3-0026b975f2e6',
33 'title': 'Nachtcafé - Alltagsdroge Alkohol - zwischen Sektempfang und Komasaufen',
34 'description': 'md5:e0a3adc17e47db2c23aab9ebc36dbee2',
35 'thumbnail': 're:http://.*\.jpg',
37 'upload_date': '20140516',
38 'uploader': 'SWR Fernsehen',
39 'uploader_id': '990030',
42 'url': 'http://swrmediathek.de/player.htm?show=bba23e10-cb93-11e3-bf7f-0026b975f2e6',
43 'md5': '4382e4ef2c9d7ce6852535fa867a0dd3',
45 'id': 'bba23e10-cb93-11e3-bf7f-0026b975f2e6',
47 'title': 'Saša Stanišic: Vor dem Fest',
48 'description': 'md5:5b792387dc3fbb171eb709060654e8c9',
49 'thumbnail': 're:http://.*\.jpg',
51 'upload_date': '20140520',
53 'uploader_id': '284670',
57 def _real_extract(self
, url
):
58 mobj
= re
.match(self
._VALID
_URL
, url
)
59 video_id
= mobj
.group('id')
61 video
= self
._download
_json
(
62 'http://swrmediathek.de/AjaxEntry?ekey=%s' % video_id
, video_id
, 'Downloading video JSON')
65 media_type
= attr
['entry_etype']
68 for entry
in video
['sub']:
69 if entry
['name'] != 'entry_media':
72 entry_attr
= entry
['attr']
73 codec
= entry_attr
['val0']
74 quality
= int(entry_attr
['val1'])
77 'url': entry_attr
['val2'],
81 if media_type
== 'Video':
83 'format_note': ['144p', '288p', '544p', '720p'][quality
- 1],
86 elif media_type
== 'Audio':
92 self
._sort
_formats
(formats
)
96 'title': attr
['entry_title'],
97 'description': attr
['entry_descl'],
98 'thumbnail': attr
['entry_image_16_9'],
99 'duration': parse_duration(attr
['entry_durat']),
100 'upload_date': attr
['entry_pdatet'][:-4],
101 'uploader': attr
['channel_title'],
102 'uploader_id': attr
['channel_idkey'],