]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rbmaradio.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..compat 
import compat_str
 
  15 class RBMARadioIE(InfoExtractor
): 
  16     _VALID_URL 
= r
'https?://(?:www\.)?rbmaradio\.com/shows/(?P<show_id>[^/]+)/episodes/(?P<id>[^/?#&]+)' 
  18         'url': 'https://www.rbmaradio.com/shows/main-stage/episodes/ford-lopatin-live-at-primavera-sound-2011', 
  19         'md5': '6bc6f9bcb18994b4c983bc3bf4384d95', 
  21             'id': 'ford-lopatin-live-at-primavera-sound-2011', 
  23             'title': 'Main Stage - Ford & Lopatin', 
  24             'description': 'md5:4f340fb48426423530af5a9d87bd7b91', 
  25             'thumbnail': r
're:^https?://.*\.jpg', 
  27             'timestamp': 1307103164, 
  28             'upload_date': '20110603', 
  32     def _real_extract(self
, url
): 
  33         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  34         show_id 
= mobj
.group('show_id') 
  35         episode_id 
= mobj
.group('id') 
  37         webpage 
= self
._download
_webpage
(url
, episode_id
) 
  39         episode 
= self
._parse
_json
( 
  41                 r
'__INITIAL_STATE__\s*=\s*({.+?})\s*</script>', 
  42                 webpage
, 'json data'), 
  43             episode_id
)['episodes'][show_id
][episode_id
] 
  45         title 
= episode
['title'] 
  47         show_title 
= episode
.get('showTitle') 
  49             title 
= '%s - %s' % (show_title
, title
) 
  52             'url': update_url_query(episode
['audioURL'], query
={'cbr': abr
}), 
  53             'format_id': compat_str(abr
), 
  56         } for abr 
in (96, 128, 256)] 
  58         description 
= clean_html(episode
.get('longTeaser')) 
  59         thumbnail 
= self
._proto
_relative
_url
(episode
.get('imageURL', {}).get('landscape')) 
  60         duration 
= int_or_none(episode
.get('duration')) 
  61         timestamp 
= unified_timestamp(episode
.get('publishedAt')) 
  66             'description': description
, 
  67             'thumbnail': thumbnail
, 
  69             'timestamp': timestamp
,