aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/yandexmusic.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-10-14 21:15:29 +0600
committerSergey M․ <dstftw@gmail.com>2015-10-14 21:15:29 +0600
commitab953c64a0e8b8558e95d0318110c0885a4eec3d (patch)
tree20d04746f6cef0f06770d4253a62a24f0730d7a8 /youtube_dl/extractor/yandexmusic.py
parentdb0a8ad97993cb3f0c398d3a5dc55389565e0ffd (diff)
downloadyoutube-dl-ab953c64a0e8b8558e95d0318110c0885a4eec3d.zip
youtube-dl-ab953c64a0e8b8558e95d0318110c0885a4eec3d.tar.gz
youtube-dl-ab953c64a0e8b8558e95d0318110c0885a4eec3d.tar.bz2
[yandexmusic:track] Extract original size thumbnail (Closes #7160)
Diffstat (limited to 'youtube_dl/extractor/yandexmusic.py')
-rw-r--r--youtube_dl/extractor/yandexmusic.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/youtube_dl/extractor/yandexmusic.py b/youtube_dl/extractor/yandexmusic.py
index 6842f83..08dc81f 100644
--- a/youtube_dl/extractor/yandexmusic.py
+++ b/youtube_dl/extractor/yandexmusic.py
@@ -46,14 +46,12 @@ class YandexMusicTrackIE(InfoExtractor):
% (data['host'], key, data['ts'] + data['path'], storage[1]))
def _get_track_info(self, track):
- album = track['albums'][0]
- a_thumb = None
-
- if 'coverUri' in album:
- a_thumb = album['coverUri']
- if a_thumb:
- a_thumb = 'http://' + a_thumb.replace('%%', '1000x1000')
-
+ thumbnail = None
+ cover_uri = track.get('albums', [{}])[0].get('coverUri')
+ if cover_uri:
+ thumbnail = cover_uri.replace('%%', 'orig')
+ if not thumbnail.startswith('http'):
+ thumbnail = 'http://' + thumbnail
return {
'id': track['id'],
'ext': 'mp3',
@@ -61,7 +59,7 @@ class YandexMusicTrackIE(InfoExtractor):
'title': '%s - %s' % (track['artists'][0]['name'], track['title']),
'filesize': int_or_none(track.get('fileSize')),
'duration': float_or_none(track.get('durationMs'), 1000),
- 'thumbnail': a_thumb,
+ 'thumbnail': thumbnail,
}
def _real_extract(self, url):