1
0
Fork 0
mirror of https://codeberg.org/polarisfm/youtube-dl.git synced 2024-12-26 17:46:45 +00:00

[yandexmusic:track] Extract original size thumbnail (Closes #7160)

This commit is contained in:
Sergey M․ 2015-10-14 21:15:29 +06:00
parent db0a8ad979
commit ab953c64a0

View file

@ -46,14 +46,12 @@ class YandexMusicTrackIE(InfoExtractor):
% (data['host'], key, data['ts'] + data['path'], storage[1])) % (data['host'], key, data['ts'] + data['path'], storage[1]))
def _get_track_info(self, track): def _get_track_info(self, track):
album = track['albums'][0] thumbnail = None
a_thumb = None cover_uri = track.get('albums', [{}])[0].get('coverUri')
if cover_uri:
if 'coverUri' in album: thumbnail = cover_uri.replace('%%', 'orig')
a_thumb = album['coverUri'] if not thumbnail.startswith('http'):
if a_thumb: thumbnail = 'http://' + thumbnail
a_thumb = 'http://' + a_thumb.replace('%%', '1000x1000')
return { return {
'id': track['id'], 'id': track['id'],
'ext': 'mp3', 'ext': 'mp3',
@ -61,7 +59,7 @@ class YandexMusicTrackIE(InfoExtractor):
'title': '%s - %s' % (track['artists'][0]['name'], track['title']), 'title': '%s - %s' % (track['artists'][0]['name'], track['title']),
'filesize': int_or_none(track.get('fileSize')), 'filesize': int_or_none(track.get('fileSize')),
'duration': float_or_none(track.get('durationMs'), 1000), 'duration': float_or_none(track.get('durationMs'), 1000),
'thumbnail': a_thumb, 'thumbnail': thumbnail,
} }
def _real_extract(self, url): def _real_extract(self, url):