]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/reverbnation.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
  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         'md5': 'c0aaf339bcee189495fdf5a8c8ba8645', 
  19             'uploader': 'ALKILADOS', 
  20             'uploader_id': '216429', 
  21             'thumbnail': r
're:^https?://.*\.jpg', 
  25     def _real_extract(self
, url
): 
  26         song_id 
= self
._match
_id
(url
) 
  28         api_res 
= self
._download
_json
( 
  29             'https://api.reverbnation.com/song/%s' % song_id
, 
  31             note
='Downloading information of song %s' % song_id
 
  34         THUMBNAILS 
= ('thumbnail', 'image') 
  35         quality 
= qualities(THUMBNAILS
) 
  37         for thumb_key 
in THUMBNAILS
: 
  38             if api_res
.get(thumb_key
): 
  40                     'url': api_res
[thumb_key
], 
  41                     'preference': quality(thumb_key
) 
  46             'title': api_res
['name'], 
  47             'url': api_res
['url'], 
  48             'uploader': api_res
.get('artist', {}).get('name'), 
  49             'uploader_id': str_or_none(api_res
.get('artist', {}).get('id')), 
  50             'thumbnails': thumbnails
,