mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-07-01 07:49:52 +00:00
Compare commits
No commits in common. "7df0391049dc598fcb69c8478d3be9fe45a91fd9" and "cdbfe3a79311078ec73753763b34570332448f06" have entirely different histories.
7df0391049
...
cdbfe3a793
@ -832,20 +832,19 @@ class VKMusicBaseIE(VKBaseIE):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def _raise_if_blocked(self, meta, track_id):
|
def _raise_if_blocked(self, meta, track_id):
|
||||||
if len(meta) < 12:
|
|
||||||
return None
|
|
||||||
|
|
||||||
reason = traverse_obj(
|
reason = traverse_obj(
|
||||||
self._parse_json(meta[12], track_id, fatal=False),
|
self._parse_json(
|
||||||
|
meta[12] if len(meta) >= 12 else None,
|
||||||
|
track_id, fatal=False),
|
||||||
('claim', 'reason'))
|
('claim', 'reason'))
|
||||||
|
|
||||||
if reason is not None:
|
if reason == 'geo':
|
||||||
if reason == 'geo':
|
self.raise_geo_restricted()
|
||||||
self.raise_geo_restricted()
|
# can be an empty string
|
||||||
|
elif reason is not None:
|
||||||
# an empty string or an internal ID
|
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
f'This track is unavailable. Reason code: {reason:r}')
|
'This track is unavailable. '
|
||||||
|
f'Reason code: {reason:r}')
|
||||||
|
|
||||||
|
|
||||||
class VKMusicTrackIE(VKMusicBaseIE):
|
class VKMusicTrackIE(VKMusicBaseIE):
|
||||||
@ -869,7 +868,7 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
'uploader': 'Skillet',
|
'uploader': 'Skillet',
|
||||||
'artists': ['Skillet'],
|
'artists': ['Skillet'],
|
||||||
'duration': 230,
|
'duration': 230,
|
||||||
'thumbnail': r're:^https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
@ -887,7 +886,7 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
'uploader': 'Pusha T, Stormzy',
|
'uploader': 'Pusha T, Stormzy',
|
||||||
'artists': ['Pusha T', 'Stormzy'],
|
'artists': ['Pusha T', 'Stormzy'],
|
||||||
'duration': 211,
|
'duration': 211,
|
||||||
'thumbnail': r're:^https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
@ -904,7 +903,7 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
'uploader': 'Linkin Park feat. Page Hamilton',
|
'uploader': 'Linkin Park feat. Page Hamilton',
|
||||||
'artists': ['Linkin Park', 'Page Hamilton'],
|
'artists': ['Linkin Park', 'Page Hamilton'],
|
||||||
'duration': 213,
|
'duration': 213,
|
||||||
'thumbnail': r're:^https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
@ -938,7 +937,7 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
'uploader': 'Jack Thomas feat. Nico & Vinz',
|
'uploader': 'Jack Thomas feat. Nico & Vinz',
|
||||||
'artists': ['Jack Thomas', 'Nico & Vinz'],
|
'artists': ['Jack Thomas', 'Nico & Vinz'],
|
||||||
'duration': 207,
|
'duration': 207,
|
||||||
'thumbnail': r're:^https?://.*\.jpg',
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
'age_limit': 0,
|
'age_limit': 0,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
@ -951,7 +950,6 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
mobj = self._match_valid_url(url)
|
mobj = self._match_valid_url(url)
|
||||||
track_id = mobj.group('id')
|
track_id = mobj.group('id')
|
||||||
access_hash = mobj.group('hash')
|
access_hash = mobj.group('hash')
|
||||||
vk_id = self._parse_vk_id()
|
|
||||||
|
|
||||||
if not access_hash:
|
if not access_hash:
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
@ -965,7 +963,7 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
if data_audio:
|
if data_audio:
|
||||||
meta = self._parse_json(unescapeHTML(data_audio), track_id)
|
meta = self._parse_json(unescapeHTML(data_audio), track_id)
|
||||||
else:
|
else:
|
||||||
if vk_id == 0:
|
if self._parse_vk_id() == 0:
|
||||||
self.raise_login_required(
|
self.raise_login_required(
|
||||||
'This track is unavailable. '
|
'This track is unavailable. '
|
||||||
'Log in or provide a link with access hash')
|
'Log in or provide a link with access hash')
|
||||||
@ -987,18 +985,18 @@ class VKMusicTrackIE(VKMusicBaseIE):
|
|||||||
|
|
||||||
access_hash = meta[24]
|
access_hash = meta[24]
|
||||||
|
|
||||||
try:
|
meta = self._download_payload('al_audio', track_id, {
|
||||||
meta = self._download_payload('al_audio', track_id, {
|
'act': 'reload_audios',
|
||||||
'act': 'reload_audios',
|
'audio_ids': f'{track_id}_{access_hash}',
|
||||||
'audio_ids': f'{track_id}_{access_hash}',
|
})[0]
|
||||||
})[0][0]
|
|
||||||
except (ExtractorError, IndexError):
|
|
||||||
if vk_id == 0:
|
|
||||||
self.raise_login_required()
|
|
||||||
raise ExtractorError('This track is unavailable')
|
|
||||||
|
|
||||||
|
# vk sends an empty list when auth required
|
||||||
|
if not meta:
|
||||||
|
self.raise_login_required()
|
||||||
|
|
||||||
|
meta = meta[0]
|
||||||
self._raise_if_blocked(meta, track_id)
|
self._raise_if_blocked(meta, track_id)
|
||||||
url = self._unmask_url(meta[2], vk_id)
|
url = self._unmask_url(meta[2], self._parse_vk_id())
|
||||||
|
|
||||||
return {
|
return {
|
||||||
**self._parse_track_meta(meta, track_id),
|
**self._parse_track_meta(meta, track_id),
|
||||||
@ -1035,7 +1033,7 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
'album': 'One More Light',
|
'album': 'One More Light',
|
||||||
'uploader': 'Linkin Park',
|
'uploader': 'Linkin Park',
|
||||||
'artists': ['Linkin Park'],
|
'artists': ['Linkin Park'],
|
||||||
'thumbnails': [{'url': r're:^https?://.*\.jpg'}],
|
'thumbnails': [{'url': r're:https?://.*\.jpg'}],
|
||||||
'genres': ['Alternative'],
|
'genres': ['Alternative'],
|
||||||
'release_year': 2017,
|
'release_year': 2017,
|
||||||
},
|
},
|
||||||
@ -1044,20 +1042,6 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'note': 'special symbols must be unescaped',
|
|
||||||
'url': 'https://vk.com/music/playlist/-25611523_85178143',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '-25611523_85178143',
|
|
||||||
'title': 'Mondträume – Lovers, Sinners & Liars (2019, Alfa Matrix)',
|
|
||||||
'uploader': 'E:\\music\\futurepop',
|
|
||||||
'thumbnails': [{'url': r're:^https?://.*\.jpg'}],
|
|
||||||
},
|
|
||||||
'playlist_count': 22,
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'url': 'https://vk.com/audios877252112?block=playlists§ion=general&z=audio_playlist-147845620_2390',
|
'url': 'https://vk.com/audios877252112?block=playlists§ion=general&z=audio_playlist-147845620_2390',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -1065,7 +1049,7 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
'title': 'VK Fest 2024: Белая сцена',
|
'title': 'VK Fest 2024: Белая сцена',
|
||||||
'description': 'md5:6d652551bb1faaddbcd46321a77fa8d0',
|
'description': 'md5:6d652551bb1faaddbcd46321a77fa8d0',
|
||||||
'uploader': 'VK Музыка',
|
'uploader': 'VK Музыка',
|
||||||
'thumbnails': [{'url': r're:^https?://.*\.jpg'}],
|
'thumbnails': [{'url': r're:https?://.*\.jpg'}],
|
||||||
},
|
},
|
||||||
'playlist_count': 18,
|
'playlist_count': 18,
|
||||||
'params': {
|
'params': {
|
||||||
@ -1079,7 +1063,7 @@ class VKMusicPlaylistIE(VKMusicBaseIE):
|
|||||||
'title': 'Электроника: новинки',
|
'title': 'Электроника: новинки',
|
||||||
'description': 're:^Актуальные новинки электронной музыки',
|
'description': 're:^Актуальные новинки электронной музыки',
|
||||||
'uploader': 'VK Музыка',
|
'uploader': 'VK Музыка',
|
||||||
'thumbnails': [{'url': r're:^https?://.*\.jpg'}],
|
'thumbnails': [{'url': r're:https?://.*\.jpg'}],
|
||||||
},
|
},
|
||||||
'playlist_mincount': 100,
|
'playlist_mincount': 100,
|
||||||
'params': {
|
'params': {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user