diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py index 2eddbacd9..e29ad2b0d 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -14,7 +14,9 @@ UserNotLive, clean_html, get_element_by_class, + get_element_html_by_class, get_element_html_by_id, + extract_attributes, int_or_none, join_nonempty, parse_qs, @@ -793,6 +795,23 @@ class VKMusicIE(VKBaseIE): 'skip_download': True, }, }, + { + 'note': 'meta is AudioPlayerBlock__root[data-exec], no artists in 17/18', + 'url': 'https://vk.com/audio-26549346_456239443', + 'info_dict': { + 'id': '-26549346_456239443', + 'ext': 'm4a', + 'title': 'Fairie\'s Death Waltz - Still to Wake', + 'track': 'Still to Wake', + 'uploader': 'Fairie\'s Death Waltz', + 'artists': ['Fairie\'s Death Waltz'], + 'duration': 349, + 'thumbnail': r're:https?://.*\.jpg', + }, + 'params': { + 'skip_download': True, + } + }, { 'url': 'https://vk.com/artist/linkinpark/releases?z=audio_playlist-2000984503_984503%2Fc468f3a862b6f73b55', 'info_dict': { @@ -852,10 +871,19 @@ def _real_extract(self, url): # copied regex from VKWallPostIE # XXX: common code should be unified, moved to a class data_audio = self._search_regex( - r'data-audio="([^"]+)', - webpage, 'data-audio attr', group=1) + r'data-audio="([^"]+)', webpage, 'data-audio attr', + default=None, group=1) + + if data_audio: + meta = self._parse_json(unescapeHTML(data_audio), track_id) + else: + player = get_element_html_by_class('AudioPlayerBlock__root', webpage) + meta = traverse_obj( + self._parse_json( + extract_attributes(player).get('data-exec'), + track_id), + ('AudioPlayerBlock/init', 'firstAudio')) - meta = self._parse_json(unescapeHTML(data_audio), track_id) one_more_id = meta[24] del data_audio