2014-07-09 21:10:02 -05:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import strip_jsonp
|
|
|
|
|
|
|
|
|
|
|
|
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': {
|
2014-08-10 03:56:37 -05:00
|
|
|
"id": "16965047",
|
|
|
|
"ext": "mp3",
|
2014-07-09 21:10:02 -05:00
|
|
|
"title": "MONA LISA",
|
|
|
|
"uploader": "ALKILADOS",
|
|
|
|
"uploader_id": 216429,
|
2014-08-10 03:45:27 -05:00
|
|
|
"thumbnail": "re:^https://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$"
|
2014-07-09 21:10:02 -05: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 03:58:22 -05:00
|
|
|
'https://api.reverbnation.com/song/%s' % song_id,
|
2014-07-09 21:10:02 -05: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'),
|
|
|
|
'uploader_id': api_res.get('artist', {}).get('id'),
|
2014-08-10 03:45:27 -05:00
|
|
|
'thumbnail': self._proto_relative_url(
|
|
|
|
api_res.get('image', api_res.get('thumbnail'))),
|
2014-07-09 21:10:02 -05:00
|
|
|
'ext': 'mp3',
|
|
|
|
'vcodec': 'none',
|
|
|
|
}
|