]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wdr.py
45466e31b7445f8dd8da742308dcc69f2ff1152f
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
18 class WDRIE(InfoExtractor
):
19 _PLAYER_REGEX
= '-(?:video|audio)player(?:_size-[LMS])?'
20 _VALID_URL
= r
'(?P<url>https?://www\d?\.(?:wdr\d?|funkhauseuropa)\.de/)(?P<id>.+?)(?P<player>%s)?\.html' % _PLAYER_REGEX
24 'url': 'http://www1.wdr.de/mediathek/video/sendungen/servicezeit/videoservicezeit560-videoplayer_size-L.html',
28 'title': 'Servicezeit',
29 'description': 'md5:c8f43e5e815eeb54d0b96df2fba906cb',
30 'upload_date': '20140310',
33 'skip_download': True,
37 'url': 'http://www1.wdr.de/themen/av/videomargaspiegelisttot101-videoplayer.html',
41 'title': 'Marga Spiegel ist tot',
42 'description': 'md5:2309992a6716c347891c045be50992e4',
43 'upload_date': '20140311',
46 'skip_download': True,
50 'url': 'http://www1.wdr.de/themen/kultur/audioerlebtegeschichtenmargaspiegel100-audioplayer.html',
51 'md5': '83e9e8fefad36f357278759870805898',
55 'title': 'Erlebte Geschichten: Marga Spiegel (29.11.2009)',
56 'description': 'md5:2309992a6716c347891c045be50992e4',
57 'upload_date': '20091129',
61 'url': 'http://www.funkhauseuropa.de/av/audioflaviacoelhoamaramar100-audioplayer.html',
62 'md5': '99a1443ff29af19f6c52cf6f4dc1f4aa',
66 'title': 'Flavia Coelho: Amar é Amar',
67 'description': 'md5:7b29e97e10dfb6e265238b32fa35b23a',
68 'upload_date': '20140717',
72 'url': 'http://www1.wdr.de/mediathek/video/sendungen/quarks_und_co/filterseite-quarks-und-co100.html',
73 'playlist_mincount': 146,
77 def _real_extract(self
, url
):
78 mobj
= re
.match(self
._VALID
_URL
, url
)
79 page_url
= mobj
.group('url')
80 page_id
= mobj
.group('id')
82 webpage
= self
._download
_webpage
(url
, page_id
)
84 if mobj
.group('player') is None:
86 self
.url_result(page_url
+ href
, 'WDR')
87 for href
in re
.findall(r
'<a href="/?(.+?%s\.html)" rel="nofollow"' % self
._PLAYER
_REGEX
, webpage
)
90 if entries
: # Playlist page
91 return self
.playlist_result(entries
, page_id
)
95 for page_num
in itertools
.count(2):
97 r
'<li class="mediathekvideo"\s*>\s*<img[^>]*>\s*<a href="(/mediathek/video/[^"]+)"',
100 self
.url_result(page_url
+ href
, 'WDR')
102 next_url_m
= re
.search(
103 r
'<li class="nextToLast">\s*<a href="([^"]+)"', webpage
)
106 next_url
= page_url
+ next_url_m
.group(1)
107 webpage
= self
._download
_webpage
(
109 note
='Downloading playlist page %d' % page_num
)
110 return self
.playlist_result(entries
, page_id
)
112 flashvars
= compat_parse_qs(
113 self
._html
_search
_regex
(r
'<param name="flashvars" value="([^"]+)"', webpage
, 'flashvars'))
115 page_id
= flashvars
['trackerClipId'][0]
116 video_url
= flashvars
['dslSrc'][0]
117 title
= flashvars
['trackerClipTitle'][0]
118 thumbnail
= flashvars
['startPicture'][0] if 'startPicture' in flashvars
else None
120 if 'trackerClipAirTime' in flashvars
:
121 upload_date
= flashvars
['trackerClipAirTime'][0]
123 upload_date
= self
._html
_search
_meta
('DC.Date', webpage
, 'upload date')
126 upload_date
= unified_strdate(upload_date
)
128 if video_url
.endswith('.f4m'):
129 video_url
+= '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18'
132 ext
= determine_ext(video_url
)
134 description
= self
._html
_search
_meta
('Description', webpage
, 'description')
141 'description': description
,
142 'thumbnail': thumbnail
,
143 'upload_date': upload_date
,
147 class WDRMobileIE(InfoExtractor
):
148 _VALID_URL
= r
'''(?x)
149 https?://mobile-ondemand\.wdr\.de/
150 .*?/fsk(?P<age_limit>[0-9]+)
152 (?P<id>[0-9]+)_(?P<title>[0-9]+)'''
153 IE_NAME
= 'wdr:mobile'
155 'url': 'http://mobile-ondemand.wdr.de/CMS2010/mdb/ondemand/weltweit/fsk0/42/421735/421735_4283021.mp4',
162 'skip': 'Problems with loading data.'
165 def _real_extract(self
, url
):
166 mobj
= re
.match(self
._VALID
_URL
, url
)
168 'id': mobj
.group('id'),
169 'title': mobj
.group('title'),
170 'age_limit': int(mobj
.group('age_limit')),
172 'user_agent': 'mobile',
176 class WDRMausIE(InfoExtractor
):
177 _VALID_URL
= 'http://(?:www\.)?wdrmaus\.de/(?:[^/]+/){,2}(?P<id>[^/?#]+)(?:/index\.php5|(?<!index)\.php5|/(?:$|[?#]))'
178 IE_DESC
= 'Sendung mit der Maus'
180 'url': 'http://www.wdrmaus.de/aktuelle-sendung/index.php5',
182 'id': 'aktuelle-sendung',
184 'thumbnail': 're:^http://.+\.jpg',
185 'upload_date': 're:^[0-9]{8}$',
186 'title': 're:^[0-9.]{10} - Aktuelle Sendung$',
189 'url': 'http://www.wdrmaus.de/sachgeschichten/sachgeschichten/40_jahre_maus.php5',
190 'md5': '3b1227ca3ed28d73ec5737c65743b2a3',
192 'id': '40_jahre_maus',
194 'thumbnail': 're:^http://.+\.jpg',
195 'upload_date': '20131007',
196 'title': '12.03.2011 - 40 Jahre Maus',
200 def _real_extract(self
, url
):
201 video_id
= self
._match
_id
(url
)
203 webpage
= self
._download
_webpage
(url
, video_id
)
204 param_code
= self
._html
_search
_regex
(
205 r
'<a href="\?startVideo=1&([^"]+)"', webpage
, 'parameters')
207 title_date
= self
._search
_regex
(
208 r
'<div class="sendedatum"><p>Sendedatum:\s*([0-9\.]+)</p>',
210 title_str
= self
._html
_search
_regex
(
211 r
'<h1>(.*?)</h1>', webpage
, 'title')
212 title
= '%s - %s' % (title_date
, title_str
)
213 upload_date
= unified_strdate(
214 self
._html
_search
_meta
('dc.date', webpage
))
216 fields
= compat_parse_qs(param_code
)
217 video_url
= fields
['firstVideo'][0]
218 thumbnail
= compat_urlparse
.urljoin(url
, fields
['startPicture'][0])
225 jscode
= self
._download
_webpage
(
226 'http://www.wdrmaus.de/codebase/js/extended-medien.min.js',
227 video_id
, fatal
=False,
228 note
='Downloading URL translation table',
229 errnote
='Could not download URL translation table')
231 for m
in re
.finditer(
232 r
"stream:\s*'dslSrc=(?P<stream>[^']+)',\s*download:\s*'(?P<dl>[^']+)'\s*\}",
234 if video_url
.startswith(m
.group('stream')):
235 http_url
= video_url
.replace(
236 m
.group('stream'), m
.group('dl'))
243 self
._sort
_formats
(formats
)
249 'thumbnail': thumbnail
,
250 'upload_date': upload_date
,