mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[reverbnation] Eliminate code duplication in thumbnails extraction
This commit is contained in:
parent
3adb9d119e
commit
f68901e50a
1 changed files with 12 additions and 10 deletions
|
@ -1,7 +1,10 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import str_or_none
|
from ..utils import (
|
||||||
|
qualities,
|
||||||
|
str_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ReverbNationIE(InfoExtractor):
|
class ReverbNationIE(InfoExtractor):
|
||||||
|
@ -28,16 +31,15 @@ def _real_extract(self, url):
|
||||||
note='Downloading information of song %s' % song_id
|
note='Downloading information of song %s' % song_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
THUMBNAILS = ('thumbnail', 'image')
|
||||||
|
quality = qualities(THUMBNAILS)
|
||||||
thumbnails = []
|
thumbnails = []
|
||||||
if api_res.get('image'):
|
for thumb_key in THUMBNAILS:
|
||||||
thumbnails.append({
|
if api_res.get(thumb_key):
|
||||||
'url': api_res.get('image'),
|
thumbnails.append({
|
||||||
})
|
'url': api_res[thumb_key],
|
||||||
if api_res.get('thumbnail'):
|
'preference': quality(thumb_key)
|
||||||
thumbnails.append({
|
})
|
||||||
'url': api_res.get('thumbnail'),
|
|
||||||
'preference': -2,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': song_id,
|
'id': song_id,
|
||||||
|
|
Loading…
Reference in a new issue