mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Use short-hand block notation for parsing chapters
This commit is contained in:
parent
6f62de36d7
commit
9535009864
@ -397,11 +397,11 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
|
|||||||
# Yes,`decoratedPlayerBarRenderer` is repeated twice.
|
# Yes,`decoratedPlayerBarRenderer` is repeated twice.
|
||||||
if player_bar = player_overlays.try &.dig?("decoratedPlayerBarRenderer", "decoratedPlayerBarRenderer", "playerBar")
|
if player_bar = player_overlays.try &.dig?("decoratedPlayerBarRenderer", "decoratedPlayerBarRenderer", "playerBar")
|
||||||
if markers = player_bar.dig?("multiMarkersPlayerBarRenderer", "markersMap")
|
if markers = player_bar.dig?("multiMarkersPlayerBarRenderer", "markersMap")
|
||||||
potential_chapters_array = markers.as_a.find { |m| m["key"]? == "DESCRIPTION_CHAPTERS" }
|
potential_chapters_array = markers.as_a.find(&.["key"]?.try &.== "DESCRIPTION_CHAPTERS")
|
||||||
|
|
||||||
# Let manual chapters have higher precedence than automatically generated ones.
|
# Chapters that are manually created should have a higher precedence than automatically generated chapters
|
||||||
if !potential_chapters_array
|
if !potential_chapters_array
|
||||||
potential_chapters_array = markers.as_a.find { |m| m["key"]? == "AUTO_CHAPTERS" }
|
potential_chapters_array = markers.as_a.find(&.["key"]?.try &.== "AUTO_CHAPTERS")
|
||||||
end
|
end
|
||||||
|
|
||||||
if potential_chapters_array
|
if potential_chapters_array
|
||||||
|
Loading…
Reference in New Issue
Block a user