mirror of
https://github.com/iv-org/invidious
synced 2024-11-24 03:53:27 +01:00
video parsing: raise if major root element is missing
This commit is contained in:
parent
6ddbccbc95
commit
99091e919c
@ -885,17 +885,25 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
|||||||
|
|
||||||
# Top level elements
|
# Top level elements
|
||||||
|
|
||||||
primary_results = player_response
|
main_results = player_response.dig?("contents", "twoColumnWatchNextResults")
|
||||||
.dig?("contents", "twoColumnWatchNextResults", "results", "results", "contents")
|
|
||||||
|
raise BrokenTubeException.new("twoColumnWatchNextResults") if !main_results
|
||||||
|
|
||||||
|
primary_results = main_results.dig?("results", "results", "contents")
|
||||||
|
|
||||||
|
raise BrokenTubeException.new("results") if !primary_results
|
||||||
|
|
||||||
video_primary_renderer = primary_results
|
video_primary_renderer = primary_results
|
||||||
.try &.as_a.find(&.["videoPrimaryInfoRenderer"]?)
|
.as_a.find(&.["videoPrimaryInfoRenderer"]?)
|
||||||
.try &.["videoPrimaryInfoRenderer"]
|
.try &.["videoPrimaryInfoRenderer"]
|
||||||
|
|
||||||
video_secondary_renderer = primary_results
|
video_secondary_renderer = primary_results
|
||||||
.try &.as_a.find(&.["videoSecondaryInfoRenderer"]?)
|
.as_a.find(&.["videoSecondaryInfoRenderer"]?)
|
||||||
.try &.["videoSecondaryInfoRenderer"]
|
.try &.["videoSecondaryInfoRenderer"]
|
||||||
|
|
||||||
|
raise BrokenTubeException.new("videoPrimaryInfoRenderer") if !video_primary_renderer
|
||||||
|
raise BrokenTubeException.new("videoSecondaryInfoRenderer") if !video_secondary_renderer
|
||||||
|
|
||||||
# Likes/dislikes
|
# Likes/dislikes
|
||||||
|
|
||||||
toplevel_buttons = video_primary_renderer
|
toplevel_buttons = video_primary_renderer
|
||||||
|
Loading…
Reference in New Issue
Block a user