]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wdr.py
feeb44b45ff32b4738957e44a6603cde93c8b9a4
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class WDRIE(InfoExtractor
):
15 _PLAYER_REGEX
= '-(?:video|audio)player(?:_size-[LMS])?'
16 _VALID_URL
= r
'(?P<url>https?://www\d?\.(?:wdr\d?|funkhauseuropa)\.de/)(?P<id>.+?)(?P<player>%s)?\.html' % _PLAYER_REGEX
20 'url': 'http://www1.wdr.de/mediathek/video/sendungen/servicezeit/videoservicezeit560-videoplayer_size-L.html',
24 'title': 'Servicezeit',
25 'description': 'md5:c8f43e5e815eeb54d0b96df2fba906cb',
26 'upload_date': '20140310',
29 'skip_download': True,
33 'url': 'http://www1.wdr.de/themen/av/videomargaspiegelisttot101-videoplayer.html',
37 'title': 'Marga Spiegel ist tot',
38 'description': 'md5:2309992a6716c347891c045be50992e4',
39 'upload_date': '20140311',
42 'skip_download': True,
46 'url': 'http://www1.wdr.de/themen/kultur/audioerlebtegeschichtenmargaspiegel100-audioplayer.html',
47 'md5': '83e9e8fefad36f357278759870805898',
51 'title': 'Erlebte Geschichten: Marga Spiegel (29.11.2009)',
52 'description': 'md5:2309992a6716c347891c045be50992e4',
53 'upload_date': '20091129',
57 'url': 'http://www.funkhauseuropa.de/av/audiogrenzenlosleckerbaklava101-audioplayer.html',
58 'md5': 'cfff440d4ee64114083ac44676df5d15',
62 'title': 'Grenzenlos lecker - Baklava',
63 'description': 'md5:7b29e97e10dfb6e265238b32fa35b23a',
64 'upload_date': '20140311',
69 def _real_extract(self
, url
):
70 mobj
= re
.match(self
._VALID
_URL
, url
)
71 page_url
= mobj
.group('url')
72 page_id
= mobj
.group('id')
74 webpage
= self
._download
_webpage
(url
, page_id
)
76 if mobj
.group('player') is None:
78 self
.url_result(page_url
+ href
, 'WDR')
79 for href
in re
.findall(r
'<a href="/?(.+?%s\.html)" rel="nofollow"' % self
._PLAYER
_REGEX
, webpage
)
81 return self
.playlist_result(entries
, page_id
)
83 flashvars
= compat_urlparse
.parse_qs(
84 self
._html
_search
_regex
(r
'<param name="flashvars" value="([^"]+)"', webpage
, 'flashvars'))
86 page_id
= flashvars
['trackerClipId'][0]
87 video_url
= flashvars
['dslSrc'][0]
88 title
= flashvars
['trackerClipTitle'][0]
89 thumbnail
= flashvars
['startPicture'][0] if 'startPicture' in flashvars
else None
91 if 'trackerClipAirTime' in flashvars
:
92 upload_date
= flashvars
['trackerClipAirTime'][0]
94 upload_date
= self
._html
_search
_meta
('DC.Date', webpage
, 'upload date')
97 upload_date
= unified_strdate(upload_date
)
99 if video_url
.endswith('.f4m'):
100 video_url
+= '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18'
103 ext
= determine_ext(video_url
)
105 description
= self
._html
_search
_meta
('Description', webpage
, 'description')
112 'description': description
,
113 'thumbnail': thumbnail
,
114 'upload_date': upload_date
,
118 class WDRMobileIE(InfoExtractor
):
119 _VALID_URL
= r
'''(?x)
120 https?://mobile-ondemand\.wdr\.de/
121 .*?/fsk(?P<age_limit>[0-9]+)
123 (?P<id>[0-9]+)_(?P<title>[0-9]+)'''
124 IE_NAME
= 'wdr:mobile'
126 'url': 'http://mobile-ondemand.wdr.de/CMS2010/mdb/ondemand/weltweit/fsk0/42/421735/421735_4283021.mp4',
132 '_skip': 'Will be depublicized shortly'
135 def _real_extract(self
, url
):
136 mobj
= re
.match(self
._VALID
_URL
, url
)
138 'id': mobj
.group('id'),
139 'title': mobj
.group('title'),
140 'age_limit': int(mobj
.group('age_limit')),
142 'user_agent': 'mobile',
146 class WDRMausIE(InfoExtractor
):
147 _VALID_URL
= 'http://(?:www\.)?wdrmaus\.de/(?:[^/]+/){,2}(?P<id>[^/?#]+)(?:/index\.php5|(?<!index)\.php5|/(?:$|[?#]))'
148 IE_DESC
= 'Sendung mit der Maus'
150 'url': 'http://www.wdrmaus.de/aktuelle-sendung/index.php5',
152 'id': 'aktuelle-sendung',
154 'thumbnail': 're:^http://.+\.jpg',
155 'upload_date': 're:^[0-9]{8}$',
156 'title': 're:^[0-9.]{10} - Aktuelle Sendung$',
159 'url': 'http://www.wdrmaus.de/sachgeschichten/sachgeschichten/40_jahre_maus.php5',
160 'md5': '3b1227ca3ed28d73ec5737c65743b2a3',
162 'id': '40_jahre_maus',
164 'thumbnail': 're:^http://.+\.jpg',
165 'upload_date': '20131007',
166 'title': '12.03.2011 - 40 Jahre Maus',
170 def _real_extract(self
, url
):
171 mobj
= re
.match(self
._VALID
_URL
, url
)
172 video_id
= mobj
.group('id')
174 webpage
= self
._download
_webpage
(url
, video_id
)
175 param_code
= self
._html
_search
_regex
(
176 r
'<a href="\?startVideo=1&([^"]+)"', webpage
, 'parameters')
178 title_date
= self
._search
_regex
(
179 r
'<div class="sendedatum"><p>Sendedatum:\s*([0-9\.]+)</p>',
181 title_str
= self
._html
_search
_regex
(
182 r
'<h1>(.*?)</h1>', webpage
, 'title')
183 title
= '%s - %s' % (title_date
, title_str
)
184 upload_date
= unified_strdate(
185 self
._html
_search
_meta
('dc.date', webpage
))
187 fields
= compat_parse_qs(param_code
)
188 video_url
= fields
['firstVideo'][0]
189 thumbnail
= compat_urlparse
.urljoin(url
, fields
['startPicture'][0])
196 jscode
= self
._download
_webpage
(
197 'http://www.wdrmaus.de/codebase/js/extended-medien.min.js',
198 video_id
, fatal
=False,
199 note
='Downloading URL translation table',
200 errnote
='Could not download URL translation table')
202 for m
in re
.finditer(
203 r
"stream:\s*'dslSrc=(?P<stream>[^']+)',\s*download:\s*'(?P<dl>[^']+)'\s*\}",
205 if video_url
.startswith(m
.group('stream')):
206 http_url
= video_url
.replace(
207 m
.group('stream'), m
.group('dl'))
214 self
._sort
_formats
(formats
)
220 'thumbnail': thumbnail
,
221 'upload_date': upload_date
,