mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 21:56:53 +01:00
Extract thumbnail url
This commit is contained in:
parent
5946cda7c6
commit
3eeff489e8
@ -46,6 +46,14 @@ def _get_track_url(self, storage_dir, track_id):
|
|||||||
% (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')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': track['id'],
|
'id': track['id'],
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
@ -53,6 +61,7 @@ def _get_track_info(self, track):
|
|||||||
'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,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user