2014-07-10 02:10:02 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2014-08-10 09:00:14 +00:00
|
|
|
from ..utils import str_or_none
|
2014-07-10 02:10:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ReverbNationIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$'
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://www.reverbnation.com/alkilados/song/16965047-mona-lisa',
|
|
|
|
'md5': '3da12ebca28c67c111a7f8b262d3f7a7',
|
|
|
|
'info_dict': {
|
2016-02-14 09:37:17 +00:00
|
|
|
'id': '16965047',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'title': 'MONA LISA',
|
|
|
|
'uploader': 'ALKILADOS',
|
|
|
|
'uploader_id': '216429',
|
|
|
|
'thumbnail': 're:^https://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$'
|
2014-07-10 02:10:02 +00:00
|
|
|
},
|
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
song_id = mobj.group('id')
|
|
|
|
|
|
|
|
api_res = self._download_json(
|
2014-08-10 08:58:22 +00:00
|
|
|
'https://api.reverbnation.com/song/%s' % song_id,
|
2014-07-10 02:10:02 +00:00
|
|
|
song_id,
|
|
|
|
note='Downloading information of song %s' % song_id
|
|
|
|
)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'id': song_id,
|
|
|
|
'title': api_res.get('name'),
|
|
|
|
'url': api_res.get('url'),
|
|
|
|
'uploader': api_res.get('artist', {}).get('name'),
|
2014-08-10 09:00:14 +00:00
|
|
|
'uploader_id': str_or_none(api_res.get('artist', {}).get('id')),
|
2014-08-10 08:45:27 +00:00
|
|
|
'thumbnail': self._proto_relative_url(
|
|
|
|
api_res.get('image', api_res.get('thumbnail'))),
|
2014-07-10 02:10:02 +00:00
|
|
|
'ext': 'mp3',
|
|
|
|
'vcodec': 'none',
|
|
|
|
}
|