1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

Fix yandex music extractor

Add track version (such as remix or edit) to title; avoid duplicates and http 414 error when downloading large playlists.
This commit is contained in:
pawel9797 2019-07-29 00:12:47 +03:00 committed by GitHub
parent 90634acfcf
commit 9bed0af915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,7 @@ class YandexMusicTrackIE(YandexMusicBaseIE):
'http://music.yandex.ru/handlers/track.jsx?track=%s:%s' % (track_id, album_id),
track_id, 'Downloading track JSON')['track']
track_title = track['title']
if 'version' in track: track_title += ' (%s)' % track['version']
download_data = self._download_json(
'https://music.yandex.ru/api/v2.1/handlers/track/%s:%s/web-album_track-track-track-main/download/m' % (track_id, album_id),
@ -288,8 +289,10 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
for track in tracks if track.get('id')])
missing_track_ids = [
track_id for track_id in track_ids
if track_id not in present_track_ids]
missing_tracks = self._download_json(
if track_id.split(':')[0] not in present_track_ids]
missing_tracks = []
for i in range(0, len(missing_track_ids), 500):
missing_tracks += self._download_json(
'https://music.yandex.%s/handlers/track-entries.jsx' % tld,
playlist_id, 'Downloading missing tracks JSON',
fatal=False,
@ -298,7 +301,7 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
'X-Requested-With': 'XMLHttpRequest',
},
query={
'entries': ','.join(missing_track_ids),
'entries': ','.join(missing_track_ids[i:i+500]),
'lang': tld,
'external-domain': 'music.yandex.%s' % tld,
'overembed': 'false',