-
-
Notifications
You must be signed in to change notification settings - Fork 518
[YouTube] Fix page reload required error on streams and remove TVHTML5 client #1438
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: dev
Are you sure you want to change the base?
[YouTube] Fix page reload required error on streams and remove TVHTML5 client #1438
Conversation
Playability status for the WEB client isn't checked anymore, as it requires a valid signatureTimestamp from JavaScript player to avoid a page reload error. Until we can get and use n parameter function decoding for streaming URLs of HTML5 clients again and support SABR streams, it doesn't really make sense to fetch a huge JavaScript player just to get metadata. Age-restricted content which can be watched with the embedded player is also broken due to extraction failure and non-ability to run the n parameter function, so fetching this embedded player has been also removed and all age-restricted content will throw an AgeRestrictedContentException. Playability error status checks have been adapted, as mobile clients get different error responses than the WEB client. Some strings have been extracted into constants and a fallback for unlisted privacy check has been added, in YoutubeStreamExtractor for both points.
c7c2858 to
cfa9854
Compare
Stypox
left a comment
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 had to unlock the conversation otherwise GitHub wouldn't let me post review comments 🤦♂️)
Thank you very much! The code looks good to me, and can be merged directly if needed.
| private static final Pattern C_TVHTML5_PLAYER_PATTERN = | ||
| Pattern.compile("&c=TVHTML5"); |
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.
This is being kept on purpose?
| final JsonObject webPlayerResponse = YoutubeStreamHelper.getWebMetadataPlayerResponse( | ||
| localization, contentCountry, videoId); | ||
|
|
||
| if (!isPlayerResponseNotValid(webPlayerResponse, videoId)) { |
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.
Maybe add a comment explaining why we don't check for playability
| if (reason == null) { | ||
| final String message = playabilityStatus.getArray("messages").getString(0); | ||
| if (message != null && message.contains("private")) { | ||
| if (reason != null) { |
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.
Why can't the checks for all clients coexist? I assume they wouldn't conflict with each other.
This is the extractor part of the fix for TeamNewPipe/NewPipe#13082.⚠️ It introduces breaking API changes: as TVHTML5 client won't likely be used anymore, it has be removed ⚠️
See commit messages and code changes for more details about code changes.
TODO:
YoutubeStreamExtractorDefaultTest.invalidId? The initial response is an empty JSON object, soYoutubeParsingHelper.getValidJsonResponseBodythrows aParsingException