]> jfr.im git - yt-dlp.git/commitdiff
[extractor/youtube] Add `androidSdkVersion` parameter to Android Innertube clients
authorcoletdjnz <redacted>
Mon, 8 Aug 2022 00:01:57 +0000 (12:01 +1200)
committercoletdjnz <redacted>
Mon, 8 Aug 2022 00:03:10 +0000 (12:03 +1200)
Required to prevent YouTube returning a bad player response in some cases.

See: https://github.com/yt-dlp/yt-dlp/pull/4593, https://github.com/TeamNewPipe/NewPipe/issues/8713, https://github.com/iv-org/invidious/issues/3230, https://github.com/Tyrrrz/YoutubeExplode/issues/647

Authored by: coletdjnz

yt_dlp/extractor/youtube.py

index 325aa0a2303e04c0b38d7a10087f772928fe3e5e..fc8825b19004b2728a2b7b004f08db2bfdb1e856 100644 (file)
         'INNERTUBE_CONTEXT': {
             'client': {
                 'clientName': 'ANDROID',
-                'clientVersion': '17.28.34',
+                'clientVersion': '17.29.34',
+                'androidSdkVersion': 30
             }
         },
         'INNERTUBE_CONTEXT_CLIENT_NAME': 3,
         'INNERTUBE_CONTEXT': {
             'client': {
                 'clientName': 'ANDROID_EMBEDDED_PLAYER',
-                'clientVersion': '17.28.34',
+                'clientVersion': '17.29.34',
+                'androidSdkVersion': 30
             },
         },
         'INNERTUBE_CONTEXT_CLIENT_NAME': 55,
             'client': {
                 'clientName': 'ANDROID_MUSIC',
                 'clientVersion': '5.16.51',
+                'androidSdkVersion': 30
             }
         },
         'INNERTUBE_CONTEXT_CLIENT_NAME': 21,
             'client': {
                 'clientName': 'ANDROID_CREATOR',
                 'clientVersion': '22.28.100',
+                'androidSdkVersion': 30
             },
         },
         'INNERTUBE_CONTEXT_CLIENT_NAME': 14,
@@ -3142,7 +3146,7 @@ def append_client(*client_names):
                 pr_video_id = traverse_obj(pr, ('videoDetails', 'videoId'))
                 if pr_video_id and pr_video_id != video_id:
                     self.report_warning(
-                        f'{client} client returned a player response for "{pr_video_id}" instead of "{video_id}"' + bug_reports_message())
+                        f'Skipping player response from {client} client (got player response for video "{pr_video_id}" instead of "{video_id}")' + bug_reports_message())
                 else:
                     prs.append(pr)