]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wdr.py
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,
75 'id': 'mediathek/video/sendungen/quarks_und_co/filterseite-quarks-und-co100',
80 def _real_extract(self
, url
):
81 mobj
= re
.match(self
._VALID
_URL
, url
)
82 page_url
= mobj
.group('url')
83 page_id
= mobj
.group('id')
85 webpage
= self
._download
_webpage
(url
, page_id
)
87 if mobj
.group('player') is None:
89 self
.url_result(page_url
+ href
, 'WDR')
90 for href
in re
.findall(r
'<a href="/?(.+?%s\.html)" rel="nofollow"' % self
._PLAYER
_REGEX
, webpage
)
93 if entries
: # Playlist page
94 return self
.playlist_result(entries
, page_id
)
98 for page_num
in itertools
.count(2):
100 r
'<li class="mediathekvideo"\s*>\s*<img[^>]*>\s*<a href="(/mediathek/video/[^"]+)"',
103 self
.url_result(page_url
+ href
, 'WDR')
105 next_url_m
= re
.search(
106 r
'<li class="nextToLast">\s*<a href="([^"]+)"', webpage
)
109 next_url
= page_url
+ next_url_m
.group(1)
110 webpage
= self
._download
_webpage
(
112 note
='Downloading playlist page %d' % page_num
)
113 return self
.playlist_result(entries
, page_id
)
115 flashvars
= compat_parse_qs(
116 self
._html
_search
_regex
(r
'<param name="flashvars" value="([^"]+)"', webpage
, 'flashvars'))
118 page_id
= flashvars
['trackerClipId'][0]
119 video_url
= flashvars
['dslSrc'][0]
120 title
= flashvars
['trackerClipTitle'][0]
121 thumbnail
= flashvars
['startPicture'][0] if 'startPicture' in flashvars
else None
123 if 'trackerClipAirTime' in flashvars
:
124 upload_date
= flashvars
['trackerClipAirTime'][0]
126 upload_date
= self
._html
_search
_meta
('DC.Date', webpage
, 'upload date')
129 upload_date
= unified_strdate(upload_date
)
131 if video_url
.endswith('.f4m'):
132 video_url
+= '?hdcore=3.2.0&plugin=aasp-3.2.0.77.18'
135 ext
= determine_ext(video_url
)
137 description
= self
._html
_search
_meta
('Description', webpage
, 'description')
144 'description': description
,
145 'thumbnail': thumbnail
,
146 'upload_date': upload_date
,
150 class WDRMobileIE(InfoExtractor
):
151 _VALID_URL
= r
'''(?x)
152 https?://mobile-ondemand\.wdr\.de/
153 .*?/fsk(?P<age_limit>[0-9]+)
155 (?P<id>[0-9]+)_(?P<title>[0-9]+)'''
156 IE_NAME
= 'wdr:mobile'
158 'url': 'http://mobile-ondemand.wdr.de/CMS2010/mdb/ondemand/weltweit/fsk0/42/421735/421735_4283021.mp4',
165 'skip': 'Problems with loading data.'
168 def _real_extract(self
, url
):
169 mobj
= re
.match(self
._VALID
_URL
, url
)
171 'id': mobj
.group('id'),
172 'title': mobj
.group('title'),
173 'age_limit': int(mobj
.group('age_limit')),
176 'User-Agent': 'mobile',
181 class WDRMausIE(InfoExtractor
):
182 _VALID_URL
= 'http://(?:www\.)?wdrmaus\.de/(?:[^/]+/){,2}(?P<id>[^/?#]+)(?:/index\.php5|(?<!index)\.php5|/(?:$|[?#]))'
183 IE_DESC
= 'Sendung mit der Maus'
185 'url': 'http://www.wdrmaus.de/aktuelle-sendung/index.php5',
187 'id': 'aktuelle-sendung',
189 'thumbnail': 're:^http://.+\.jpg',
190 'upload_date': 're:^[0-9]{8}$',
191 'title': 're:^[0-9.]{10} - Aktuelle Sendung$',
194 'url': 'http://www.wdrmaus.de/sachgeschichten/sachgeschichten/40_jahre_maus.php5',
195 'md5': '3b1227ca3ed28d73ec5737c65743b2a3',
197 'id': '40_jahre_maus',
199 'thumbnail': 're:^http://.+\.jpg',
200 'upload_date': '20131007',
201 'title': '12.03.2011 - 40 Jahre Maus',
205 def _real_extract(self
, url
):
206 video_id
= self
._match
_id
(url
)
208 webpage
= self
._download
_webpage
(url
, video_id
)
209 param_code
= self
._html
_search
_regex
(
210 r
'<a href="\?startVideo=1&([^"]+)"', webpage
, 'parameters')
212 title_date
= self
._search
_regex
(
213 r
'<div class="sendedatum"><p>Sendedatum:\s*([0-9\.]+)</p>',
215 title_str
= self
._html
_search
_regex
(
216 r
'<h1>(.*?)</h1>', webpage
, 'title')
217 title
= '%s - %s' % (title_date
, title_str
)
218 upload_date
= unified_strdate(
219 self
._html
_search
_meta
('dc.date', webpage
))
221 fields
= compat_parse_qs(param_code
)
222 video_url
= fields
['firstVideo'][0]
223 thumbnail
= compat_urlparse
.urljoin(url
, fields
['startPicture'][0])
230 jscode
= self
._download
_webpage
(
231 'http://www.wdrmaus.de/codebase/js/extended-medien.min.js',
232 video_id
, fatal
=False,
233 note
='Downloading URL translation table',
234 errnote
='Could not download URL translation table')
236 for m
in re
.finditer(
237 r
"stream:\s*'dslSrc=(?P<stream>[^']+)',\s*download:\s*'(?P<dl>[^']+)'\s*\}",
239 if video_url
.startswith(m
.group('stream')):
240 http_url
= video_url
.replace(
241 m
.group('stream'), m
.group('dl'))
248 self
._sort
_formats
(formats
)
254 'thumbnail': thumbnail
,
255 'upload_date': upload_date
,