-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add fallback to TvSimply client #5345
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
base: tvsimply-client
Are you sure you want to change the base?
Conversation
IMO it's better to create just one PR instead of two. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the condition below also needs to check for the existence of signatureCipher
invidious/src/invidious/videos/parser.cr
Line 121 in df8839d
if player_fallback_response.dig?("streamingData", "adaptiveFormats", 0, "url") |
You're right. I'll fix it and test it later. |
08f9169
to
0c96e09
Compare
I wasn't able to test it since Innertube didn't return Maybe we should really add some mocks, test data and crystal tests :/ |
src/invidious/videos/parser.cr
Outdated
@@ -146,6 +146,9 @@ def extract_video_info(video_id : String) | |||
if streaming_data = player_response["streamingData"]? | |||
%w[formats adaptiveFormats].each do |key| | |||
streaming_data.as_h[key]?.try &.as_a.each do |format| | |||
if format.as_h["url"].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if format.as_h["url"].nil? | |
if format.as_h["url"]?.nil? |
src/invidious/videos/parser.cr
Outdated
@@ -146,6 +146,9 @@ def extract_video_info(video_id : String) | |||
if streaming_data = player_response["streamingData"]? | |||
%w[formats adaptiveFormats].each do |key| | |||
streaming_data.as_h[key]?.try &.as_a.each do |format| | |||
if format.as_h["url"].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hash conversion should be called as_h
only once:
format = format.as_h
Technically there already are mocks and tests, there's just not enough of it and imo the current system is confusing to understand. I don't fully understand it myself if I'm being honest but I believe you'll need to update |
src/invidious/videos/parser.cr
Outdated
|
||
players_fallback.each do |player_fallback| | ||
client_config.client_type = player_fallback | ||
|
||
next if !(player_fallback_response = try_fetch_streaming_data(video_id, client_config)) | ||
|
||
if player_fallback_response.dig?("streamingData", "adaptiveFormats", 0, "url") | ||
if player_fallback_response.dig?("streamingData", "adaptiveFormats", 0, "url") || player_fallback_response.dig?("streamingData", "adaptiveFormats", 0, "signatureCipher") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you save the result of player_fallback_response.dig?("streamingData", "adaptiveFormats", 0)
to a temporary variable first so that there isn't a double traversal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is cf0a68b good enough?
018b666
to
cf0a68b
Compare
I have taken the opportunity to remove the TV fallback here because of iv-org/invidious-companion#157 |
Depends on: #5344
Uses the same order Invidious companion uses: https://github.com/iv-org/invidious-companion/blob/d0c4bb79ae4688d019fb281257859e334adb7d8b/src/lib/helpers/youtubePlayerReq.ts#L75