1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-28 01:18:30 +00:00

feat: correct errs when auth required or geoblocked

This commit is contained in:
DarkCat09 2025-04-01 16:44:30 +04:00
parent cab6eeeae2
commit c71008ed60
No known key found for this signature in database

View File

@ -922,15 +922,28 @@ def _real_extract(self, url):
if data_audio:
meta = self._parse_json(unescapeHTML(data_audio), track_id)
else:
if self._parse_vk_id() == 0:
self.raise_login_required(
'This track is unavailable. '
'Log in or provide a link with access hash')
data_exec = self._search_regex(
r'class="AudioPlayerBlock__root"[^>]+data-exec="([^"]+)',
webpage, 'AudioPlayerBlock data-exec', group=1)
meta = traverse_obj(
self._parse_json(unescapeHTML(data_exec), track_id),
('AudioPlayerBlock/init', 'firstAudio'))
one_more_id = meta[24]
block_reason = traverse_obj(
self._parse_json(meta[12], track_id, fatal=False),
('claim', 'reason'))
if block_reason == 'geo':
self.raise_geo_restricted()
del data_audio
del webpage