1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-20 01:42:50 +01:00

[extractor/youtube] Prevent redirect to unwanted videos (#4593)

Example: https://www.youtube.com/watch?v=aQvGIIdgFDM

Authored by: coletdjnz
This commit is contained in:
coletdjnz 2022-08-07 13:43:20 +00:00 committed by GitHub
parent 43aebb7db4
commit a3e9642116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3133,6 +3133,13 @@ def append_client(*client_names):
continue
if pr:
# YouTube may return a different video player response than expected.
# See: https://github.com/TeamNewPipe/NewPipe/issues/8713
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())
else:
prs.append(pr)
# creator clients can bypass AGE_VERIFICATION_REQUIRED if logged in