aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-06-22 00:20:04 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-06-22 01:36:06 +0530
commit1e75d97db21152acc764b30a688e516f04b8a142 (patch)
treea4deefe7a57f0f62018c45089204a8497c65733f /yt_dlp
parent81ca451480051d7ce1a31c017e005358345a9149 (diff)
downloadhypervideo-pre-1e75d97db21152acc764b30a688e516f04b8a142.tar.lz
hypervideo-pre-1e75d97db21152acc764b30a688e516f04b8a142.tar.xz
hypervideo-pre-1e75d97db21152acc764b30a688e516f04b8a142.zip
[extractor/youtube] Add `ios` to default clients used
* IOS is affected neither by 403 or by nsig so helps mitigate them preemptively * IOS also has higher bit-rate "premium" formats though they are not labeled as such
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/extractor/youtube.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index a77a626ac..a90118680 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -258,7 +258,7 @@ def build_innertube_clients():
THIRD_PARTY = {
'embedUrl': 'https://www.youtube.com/', # Can be any valid URL
}
- BASE_CLIENTS = ('android', 'web', 'tv', 'ios', 'mweb')
+ BASE_CLIENTS = ('ios', 'android', 'web', 'tv', 'mweb')
priority = qualities(BASE_CLIENTS[::-1])
for client, ytcfg in tuple(INNERTUBE_CLIENTS.items()):
@@ -3625,7 +3625,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def _get_requested_clients(self, url, smuggled_data):
requested_clients = []
- default = ['android', 'web']
+ default = ['ios', 'android', 'web']
allowed_clients = sorted(
(client for client in INNERTUBE_CLIENTS.keys() if client[:1] != '_'),
key=lambda client: INNERTUBE_CLIENTS[client]['priority'], reverse=True)
@@ -3932,6 +3932,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
elif itag:
f['format_id'] = itag
+ if itag in ('616', '235'):
+ f['format_note'] = join_nonempty(f.get('format_note'), 'Premium', delim=' ')
+ f['source_preference'] = (f.get('source_preference') or -1) + 100
+
f['quality'] = q(itag_qualities.get(try_get(f, lambda f: f['format_id'].split('-')[0]), -1))
if f['quality'] == -1 and f.get('height'):
f['quality'] = q(res_qualities[min(res_qualities, key=lambda x: abs(x - f['height']))])