]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/reverbnation.py
49cf427a1141ee6f8fd14aca490e088dedbe3d73
   1 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
   7 from ..utils 
import strip_jsonp
 
  10 class ReverbNationIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$' 
  13         'url': 'http://www.reverbnation.com/alkilados/song/16965047-mona-lisa', 
  14         'file': '16965047.mp3', 
  15         'md5': '3da12ebca28c67c111a7f8b262d3f7a7', 
  18             "uploader": "ALKILADOS", 
  19             "uploader_id": 216429, 
  20             "thumbnail": "//gp1.wac.edgecastcdn.net/802892/production_public/Photo/13761700/image/1366002176_AVATAR_MONA_LISA.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?callback=api_response_5&_=%d' 
  30                 % (song_id
, int(time
.time() * 1000)), 
  32             transform_source
=strip_jsonp
, 
  33             note
='Downloading information of song %s' % song_id
 
  38             'title': api_res
.get('name'), 
  39             'url': api_res
.get('url'), 
  40             'uploader': api_res
.get('artist', {}).get('name'), 
  41             'uploader_id': api_res
.get('artist', {}).get('id'), 
  42             'thumbnail': api_res
.get('image', api_res
.get('thumbnail')),