mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-21 18:24:47 +00:00
Compare commits
No commits in common. "81bdea03f3414dd4d086610c970ec14e15bd3d36" and "97f03660f55696dc9fce56e7ee43fbe3324a9867" have entirely different histories.
81bdea03f3
...
97f03660f5
@ -118,9 +118,9 @@ class SoundcloudBaseIE(InfoExtractor):
|
|||||||
self.cache.store('soundcloud', 'client_id', client_id)
|
self.cache.store('soundcloud', 'client_id', client_id)
|
||||||
|
|
||||||
def _update_client_id(self):
|
def _update_client_id(self):
|
||||||
webpage = self._download_webpage('https://soundcloud.com/', None, 'Downloading main page')
|
webpage = self._download_webpage('https://soundcloud.com/', None)
|
||||||
for src in reversed(re.findall(r'<script[^>]+src="([^"]+)"', webpage)):
|
for src in reversed(re.findall(r'<script[^>]+src="([^"]+)"', webpage)):
|
||||||
script = self._download_webpage(src, None, 'Downloading JS asset', fatal=False)
|
script = self._download_webpage(src, None, fatal=False)
|
||||||
if script:
|
if script:
|
||||||
client_id = self._search_regex(
|
client_id = self._search_regex(
|
||||||
r'client_id\s*:\s*"([0-9a-zA-Z]{32})"',
|
r'client_id\s*:\s*"([0-9a-zA-Z]{32})"',
|
||||||
@ -136,13 +136,13 @@ class SoundcloudBaseIE(InfoExtractor):
|
|||||||
if non_fatal:
|
if non_fatal:
|
||||||
del kwargs['fatal']
|
del kwargs['fatal']
|
||||||
query = kwargs.get('query', {}).copy()
|
query = kwargs.get('query', {}).copy()
|
||||||
for is_first_attempt in (True, False):
|
for _ in range(2):
|
||||||
query['client_id'] = self._CLIENT_ID
|
query['client_id'] = self._CLIENT_ID
|
||||||
kwargs['query'] = query
|
kwargs['query'] = query
|
||||||
try:
|
try:
|
||||||
return self._download_json(*args, **kwargs)
|
return self._download_json(*args, **kwargs)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if is_first_attempt and isinstance(e.cause, HTTPError) and e.cause.status in (401, 403):
|
if isinstance(e.cause, HTTPError) and e.cause.status in (401, 403):
|
||||||
self._store_client_id(None)
|
self._store_client_id(None)
|
||||||
self._update_client_id()
|
self._update_client_id()
|
||||||
continue
|
continue
|
||||||
@ -152,10 +152,7 @@ class SoundcloudBaseIE(InfoExtractor):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def _initialize_pre_login(self):
|
def _initialize_pre_login(self):
|
||||||
self._CLIENT_ID = self.cache.load('soundcloud', 'client_id')
|
self._CLIENT_ID = self.cache.load('soundcloud', 'client_id') or 'a3e059563d7fd3372b49b37f00a00bcf'
|
||||||
if self._CLIENT_ID:
|
|
||||||
return
|
|
||||||
self._update_client_id()
|
|
||||||
|
|
||||||
def _verify_oauth_token(self, token):
|
def _verify_oauth_token(self, token):
|
||||||
if self._request_webpage(
|
if self._request_webpage(
|
||||||
|
|||||||
@ -175,13 +175,6 @@ _TARGETS_COMPAT_LOOKUP = {
|
|||||||
'safari180_ios': 'safari18_0_ios',
|
'safari180_ios': 'safari18_0_ios',
|
||||||
}
|
}
|
||||||
|
|
||||||
# These targets are known to be insufficient, unreliable or blocked
|
|
||||||
# See: https://github.com/yt-dlp/yt-dlp/issues/16012
|
|
||||||
_DEPRIORITIZED_TARGETS = {
|
|
||||||
ImpersonateTarget('chrome', '133', 'macos', '15'), # chrome133a
|
|
||||||
ImpersonateTarget('chrome', '136', 'macos', '15'), # chrome136
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@register_rh
|
@register_rh
|
||||||
class CurlCFFIRH(ImpersonateRequestHandler, InstanceStoreMixin):
|
class CurlCFFIRH(ImpersonateRequestHandler, InstanceStoreMixin):
|
||||||
@ -199,8 +192,6 @@ class CurlCFFIRH(ImpersonateRequestHandler, InstanceStoreMixin):
|
|||||||
for version, targets in BROWSER_TARGETS.items()
|
for version, targets in BROWSER_TARGETS.items()
|
||||||
if curl_cffi_version >= version
|
if curl_cffi_version >= version
|
||||||
), key=lambda x: (
|
), key=lambda x: (
|
||||||
# deprioritize unreliable targets so they are not selected by default
|
|
||||||
x[1] not in _DEPRIORITIZED_TARGETS,
|
|
||||||
# deprioritize mobile targets since they give very different behavior
|
# deprioritize mobile targets since they give very different behavior
|
||||||
x[1].os not in ('ios', 'android'),
|
x[1].os not in ('ios', 'android'),
|
||||||
# prioritize tor < edge < firefox < safari < chrome
|
# prioritize tor < edge < firefox < safari < chrome
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user