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:
parent
cab6eeeae2
commit
c71008ed60
@ -922,15 +922,28 @@ def _real_extract(self, url):
|
|||||||
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 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(
|
data_exec = self._search_regex(
|
||||||
r'class="AudioPlayerBlock__root"[^>]+data-exec="([^"]+)',
|
r'class="AudioPlayerBlock__root"[^>]+data-exec="([^"]+)',
|
||||||
webpage, 'AudioPlayerBlock data-exec', group=1)
|
webpage, 'AudioPlayerBlock data-exec', group=1)
|
||||||
|
|
||||||
meta = traverse_obj(
|
meta = traverse_obj(
|
||||||
self._parse_json(unescapeHTML(data_exec), track_id),
|
self._parse_json(unescapeHTML(data_exec), track_id),
|
||||||
('AudioPlayerBlock/init', 'firstAudio'))
|
('AudioPlayerBlock/init', 'firstAudio'))
|
||||||
|
|
||||||
one_more_id = meta[24]
|
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 data_audio
|
||||||
del webpage
|
del webpage
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user