]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rbmaradio.py
   2 from __future__ 
import unicode_literals
 
   7 from .common 
import InfoExtractor
 
  13 class RBMARadioIE(InfoExtractor
): 
  14     _VALID_URL 
= r
'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$' 
  16         'url': 'http://www.rbmaradio.com/shows/ford-lopatin-live-at-primavera-sound-2011', 
  17         'md5': '6bc6f9bcb18994b4c983bc3bf4384d95', 
  19             'id': 'ford-lopatin-live-at-primavera-sound-2011', 
  21             "uploader_id": "ford-lopatin", 
  23             "description": "Joel Ford and Daniel ’Oneohtrix Point Never’ Lopatin fly their midified pop extravaganza to Spain. Live at Primavera Sound 2011.", 
  24             "uploader": "Ford & Lopatin", 
  25             "title": "Live at Primavera Sound 2011", 
  29     def _real_extract(self
, url
): 
  30         m 
= re
.match(self
._VALID
_URL
, url
) 
  31         video_id 
= m
.group('videoID') 
  33         webpage 
= self
._download
_webpage
(url
, video_id
) 
  35         json_data 
= self
._search
_regex
(r
'window\.gon.*?gon\.show=(.+?);$', 
  36             webpage
, 'json data', flags
=re
.MULTILINE
) 
  39             data 
= json
.loads(json_data
) 
  40         except ValueError as e
: 
  41             raise ExtractorError('Invalid JSON: ' + str(e
)) 
  43         video_url 
= data
['akamai_url'] + '&cbr=256' 
  48             'title': data
['title'], 
  49             'description': data
.get('teaser_text'), 
  50             'location': data
.get('country_of_origin'), 
  51             'uploader': data
.get('host', {}).get('name'), 
  52             'uploader_id': data
.get('host', {}).get('slug'), 
  53             'thumbnail': data
.get('image', {}).get('large_url_2x'), 
  54             'duration': data
.get('duration'),