Browse Source

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

totalwebcasting
Sergey M․ 9 years ago
parent
commit
ab953c64a0
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      youtube_dl/extractor/yandexmusic.py

+ 7
- 9
youtube_dl/extractor/yandexmusic.py 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]
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 { 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):


Loading…
Cancel
Save