Skip to content

Commit

Permalink
Regression from iv-org#4037 | Fix storyboards
Browse files Browse the repository at this point in the history
PR iv-org#4037 introduced a workaround around YouTube's new integrity checks
on streaming URLs. However, the usage of this workaround prevents
storyboard data from being returned by InnerTube.

This commit fixes that by only using the workaround when calling try_fetch_streaming_data
  • Loading branch information
syeopite committed Aug 8, 2023
1 parent a81c0f3 commit 6b17bb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/invidious/videos/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)
client_config = YoutubeAPI::ClientConfig.new(proxy_region: proxy_region)

# Fetch data from the player endpoint
# CgIQBg is a workaround for streaming URLs that returns a 403.
# See https://github.com/iv-org/invidious/issues/4027#issuecomment-1666944520
player_response = YoutubeAPI.player(video_id: video_id, params: "CgIQBg", client_config: client_config)
player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config)

playability_status = player_response.dig?("playabilityStatus", "status").try &.as_s

Expand Down Expand Up @@ -120,6 +118,9 @@ def extract_video_info(video_id : String, proxy_region : String? = nil)

# Replace player response and reset reason
if !new_player_response.nil?
# Preserve storyboard data before replacement
new_player_response["storyboards"] = player_response["storyboards"] if player_response["storyboards"]?

player_response = new_player_response
params.delete("reason")
end
Expand Down

0 comments on commit 6b17bb5

Please sign in to comment.