]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/reverbnation.py
   1 from __future__ 
import unicode_literals
 
   5 from .common 
import InfoExtractor
 
   6 from ..utils 
import str_or_none
 
   9 class ReverbNationIE(InfoExtractor
): 
  10     _VALID_URL 
= r
'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$' 
  12         'url': 'http://www.reverbnation.com/alkilados/song/16965047-mona-lisa', 
  13         'md5': '3da12ebca28c67c111a7f8b262d3f7a7', 
  18             'uploader': 'ALKILADOS', 
  19             'uploader_id': '216429', 
  20             'thumbnail': 're:^https://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$' 
  24     def _real_extract(self
, url
): 
  25         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  26         song_id 
= mobj
.group('id') 
  28         api_res 
= self
._download
_json
( 
  29             'https://api.reverbnation.com/song/%s' % song_id
, 
  31             note
='Downloading information of song %s' % song_id
 
  36             'title': api_res
.get('name'), 
  37             'url': api_res
.get('url'), 
  38             'uploader': api_res
.get('artist', {}).get('name'), 
  39             'uploader_id': str_or_none(api_res
.get('artist', {}).get('id')), 
  40             'thumbnail': self
._proto
_relative
_url
( 
  41                 api_res
.get('image', api_res
.get('thumbnail'))),