]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/swrmediathek.py
1 # -*- coding: utf-8 -*-
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',
56 'url': 'http://swrmediathek.de/content/player.htm?show=52dc7e00-15c5-11e4-84bc-0026b975f2e6',
57 'md5': '881531487d0633080a8cc88d31ef896f',
59 'id': '52dc7e00-15c5-11e4-84bc-0026b975f2e6',
61 'title': 'Familienspaß am Bodensee',
62 'description': 'md5:0b591225a32cfde7be1629ed49fe4315',
63 'thumbnail': 're:http://.*\.jpg',
65 'upload_date': '20140727',
66 'uploader': 'SWR Fernsehen BW',
67 'uploader_id': '281130',
71 def _real_extract(self
, url
):
72 mobj
= re
.match(self
._VALID
_URL
, url
)
73 video_id
= mobj
.group('id')
75 video
= self
._download
_json
(
76 'http://swrmediathek.de/AjaxEntry?ekey=%s' % video_id
, video_id
, 'Downloading video JSON')
79 media_type
= attr
['entry_etype']
82 for entry
in video
['sub']:
83 if entry
['name'] != 'entry_media':
86 entry_attr
= entry
['attr']
87 codec
= entry_attr
['val0']
88 quality
= int(entry_attr
['val1'])
91 'url': entry_attr
['val2'],
95 if media_type
== 'Video':
97 'format_note': ['144p', '288p', '544p'][quality
-1],
100 elif media_type
== 'Audio':
106 self
._sort
_formats
(formats
)
110 'title': attr
['entry_title'],
111 'description': attr
['entry_descl'],
112 'thumbnail': attr
['entry_image_16_9'],
113 'duration': parse_duration(attr
['entry_durat']),
114 'upload_date': attr
['entry_pdatet'][:-4],
115 'uploader': attr
['channel_title'],
116 'uploader_id': attr
['channel_idkey'],