diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2022-08-23 21:59:22 +0200 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2022-08-23 21:59:22 +0200 |
| commit | 16b23efb4fc7d566831125ae5bacf5b52c7d8fb7 (patch) | |
| tree | d96f3d393e94d026c220bd78d9568c70006d10b2 | |
| parent | 4c1a5f84fa3310a2d2d6752d4bc8d42580c9baa0 (diff) | |
| parent | 389e49183c076362bb79ad377b227257488e2bce (diff) | |
| download | invidious-16b23efb4fc7d566831125ae5bacf5b52c7d8fb7.tar.gz invidious-16b23efb4fc7d566831125ae5bacf5b52c7d8fb7.tar.bz2 invidious-16b23efb4fc7d566831125ae5bacf5b52c7d8fb7.zip | |
Throw error if the returned videoID is different (#3278)
| -rw-r--r-- | src/invidious/exceptions.cr | 3 | ||||
| -rw-r--r-- | src/invidious/videos.cr | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/invidious/exceptions.cr b/src/invidious/exceptions.cr index 05be73a6..425c08da 100644 --- a/src/invidious/exceptions.cr +++ b/src/invidious/exceptions.cr @@ -30,3 +30,6 @@ end # Exception threw when an element is not found. class NotFoundException < InfoException end + +class VideoNotAvailableException < Exception +end diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index cb1d1acf..5ed57727 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -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 |
