Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use workaround for fetching streaming URLs #4037

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/invidious/videos/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ 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
# 8AEB param is used to fetch YouTube stories
Copy link
Member Author

@syeopite syeopite Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely remove the 8AEB param since stories was entirely removed by YouTube back in late June

player_response = YoutubeAPI.player(video_id: video_id, params: "8AEB", client_config: client_config)
# 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)

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

Expand Down Expand Up @@ -135,8 +136,9 @@ end

def try_fetch_streaming_data(id : String, client_config : YoutubeAPI::ClientConfig) : Hash(String, JSON::Any)?
LOGGER.debug("try_fetch_streaming_data: [#{id}] Using #{client_config.client_type} client.")
# 8AEB param is used to fetch YouTube stories
response = YoutubeAPI.player(video_id: id, params: "8AEB", client_config: client_config)
# CgIQBg is a workaround for streaming URLs that returns a 403.
# See https://github.com/iv-org/invidious/issues/4027#issuecomment-1666944520
response = YoutubeAPI.player(video_id: id, params: "CgIQBg", client_config: client_config)

playability_status = response["playabilityStatus"]["status"]
LOGGER.debug("try_fetch_streaming_data: [#{id}] Got playabilityStatus == #{playability_status}.")
Expand Down