projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1dd58e1
)
[reverbnation] Modernize
author
Déstin Reed
<trox1972@users.noreply.github.com>
Fri, 30 Sep 2016 17:54:12 +0000
(19:54 +0200)
committer
Sergey M․
<dstftw@gmail.com>
Sat, 8 Oct 2016 18:00:38 +0000
(
01:00
+0700)
youtube_dl/extractor/reverbnation.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/reverbnation.py
b/youtube_dl/extractor/reverbnation.py
index 3c6725aeb42945ce7f4e07b49bcd0d629248fcac..52f18e2319ca9b4de1913318181d96349b316575 100644
(file)
--- a/
youtube_dl/extractor/reverbnation.py
+++ b/
youtube_dl/extractor/reverbnation.py
@@
-1,7
+1,5
@@
from __future__ import unicode_literals
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
from ..utils import str_or_none
from .common import InfoExtractor
from ..utils import str_or_none
@@
-10,20
+8,19
@@
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',
_VALID_URL = r'^https?://(?:www\.)?reverbnation\.com/.*?/song/(?P<id>\d+).*?$'
_TESTS = [{
'url': 'http://www.reverbnation.com/alkilados/song/16965047-mona-lisa',
- 'md5': '
3da12ebca28c67c111a7f8b262d3f7a7
',
+ 'md5': '
c0aaf339bcee189495fdf5a8c8ba8645
',
'info_dict': {
'id': '16965047',
'ext': 'mp3',
'title': 'MONA LISA',
'uploader': 'ALKILADOS',
'uploader_id': '216429',
'info_dict': {
'id': '16965047',
'ext': 'mp3',
'title': 'MONA LISA',
'uploader': 'ALKILADOS',
'uploader_id': '216429',
- 'thumbnail': 're:^https
://gp1\.wac\.edgecastcdn\.net/.*?\.jpg$'
+ 'thumbnail': 're:^https
?://.*\.jpg',
},
}]
def _real_extract(self, url):
},
}]
def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
- song_id = mobj.group('id')
+ song_id = self._match_id(url)
api_res = self._download_json(
'https://api.reverbnation.com/song/%s' % song_id,
api_res = self._download_json(
'https://api.reverbnation.com/song/%s' % song_id,
@@
-31,14
+28,24
@@
class ReverbNationIE(InfoExtractor):
note='Downloading information of song %s' % song_id
)
note='Downloading information of song %s' % song_id
)
+ thumbnails = []
+ if api_res.get('image'):
+ thumbnails.append({
+ 'url': api_res.get('image'),
+ })
+ if api_res.get('thumbnail'):
+ thumbnails.append({
+ 'url': api_res.get('thumbnail'),
+ 'preference': -2,
+ })
+
return {
'id': song_id,
return {
'id': song_id,
- 'title': api_res
.get('name')
,
- 'url': api_res
.get('url')
,
+ 'title': api_res
['name']
,
+ 'url': api_res
['url']
,
'uploader': api_res.get('artist', {}).get('name'),
'uploader_id': str_or_none(api_res.get('artist', {}).get('id')),
'uploader': api_res.get('artist', {}).get('name'),
'uploader_id': str_or_none(api_res.get('artist', {}).get('id')),
- 'thumbnail': self._proto_relative_url(
- api_res.get('image', api_res.get('thumbnail'))),
+ 'thumbnails': thumbnails,
'ext': 'mp3',
'vcodec': 'none',
}
'ext': 'mp3',
'vcodec': 'none',
}