mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 02:13:16 +00:00
[DeezerPlaylist] Update to new website
This commit is contained in:
parent
3bce4ff7d9
commit
297f60e62c
|
@ -18,11 +18,10 @@ class DeezerPlaylistIE(InfoExtractor):
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '176747451',
|
'id': '176747451',
|
||||||
'title': 'Best!',
|
'title': 'Best!',
|
||||||
'uploader': 'Anonymous',
|
'uploader': 'anonymous',
|
||||||
'thumbnail': r're:^https?://cdn-images\.deezer\.com/images/cover/.*\.jpg$',
|
'thumbnail': r're:^https?://e-cdns-images\.dzcdn\.net/images/cover/.*\.jpg$',
|
||||||
},
|
},
|
||||||
'playlist_count': 30,
|
'playlist_count': 29,
|
||||||
'skip': 'Only available in .de',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -46,25 +45,17 @@ def _real_extract(self, url):
|
||||||
webpage, 'data JSON')
|
webpage, 'data JSON')
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
|
||||||
playlist_title = data.get('DATA', {}).get('TITLE')
|
playlist_title = data['DATA']['TITLE']
|
||||||
playlist_uploader = data.get('DATA', {}).get('PARENT_USERNAME')
|
playlist_uploader = data['DATA']['PARENT_USERNAME']
|
||||||
playlist_thumbnail = self._search_regex(
|
playlist_thumbnail = self._search_regex(
|
||||||
r'<img id="naboo_playlist_image".*?src="([^"]+)"', webpage,
|
r'<img id="naboo_playlist_image".*?src="([^"]+)"', webpage,
|
||||||
'playlist thumbnail')
|
'playlist thumbnail')
|
||||||
|
|
||||||
preview_pattern = self._search_regex(
|
|
||||||
r"var SOUND_PREVIEW_GATEWAY\s*=\s*'([^']+)';", webpage,
|
|
||||||
'preview URL pattern', fatal=False)
|
|
||||||
entries = []
|
entries = []
|
||||||
for s in data['SONGS']['data']:
|
for s in data['SONGS']['data']:
|
||||||
puid = s['MD5_ORIGIN']
|
|
||||||
preview_video_url = preview_pattern.\
|
|
||||||
replace('{0}', puid[0]).\
|
|
||||||
replace('{1}', puid).\
|
|
||||||
replace('{2}', s['MEDIA_VERSION'])
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'format_id': 'preview',
|
'format_id': 'preview',
|
||||||
'url': preview_video_url,
|
'url': s['MEDIA'][0]['HREF'],
|
||||||
'preference': -100, # Only the first 30 seconds
|
'preference': -100, # Only the first 30 seconds
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue