Throw error if the returned videoID is different (#3278)

pull/3286/head
Samantaz Fox 2022-08-23 21:59:22 +02:00
commit 16b23efb4f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F42821059186176E
2 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -30,3 +30,6 @@ end
# Exception threw when an element is not found.
class NotFoundException < InfoException
end
class VideoNotAvailableException < Exception
end

Wyświetl plik

@ -909,6 +909,10 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
"reason" => JSON::Any.new(reason),
}
end
elsif video_id != player_response.dig("videoDetails", "videoId")
# YouTube may return a different video player response than expected.
# See: https://github.com/TeamNewPipe/NewPipe/issues/8713
raise VideoNotAvailableException.new("The video returned by YouTube isn't the requested one.")
else
reason = nil
end