]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/echomsk.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   9 class EchoMskIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'https?://(?:www\.)?echo\.msk\.ru/sounds/(?P<id>\d+)' 
  12         'url': 'http://www.echo.msk.ru/sounds/1464134.html', 
  13         'md5': '2e44b3b78daff5b458e4dbc37f191f7c', 
  17             'title': 'Особое мнение - 29 декабря 2014, 19:08', 
  21     def _real_extract(self
, url
): 
  22         video_id 
= self
._match
_id
(url
) 
  24         webpage 
= self
._download
_webpage
(url
, video_id
) 
  26         audio_url 
= self
._search
_regex
( 
  27             r
'<a rel="mp3" href="([^"]+)">', webpage
, 'audio URL') 
  29         title 
= self
._html
_search
_regex
( 
  30             r
'<a href="/programs/[^"]+" target="_blank">([^<]+)</a>', 
  33         air_date 
= self
._html
_search
_regex
( 
  34             r
'(?s)<div class="date">(.+?)</div>', 
  35             webpage
, 'date', fatal
=False, default
=None) 
  38             air_date 
= re
.sub(r
'(\s)\1+', r
'\1', air_date
) 
  40                 title 
= '%s - %s' % (title
, air_date
)