-
-
Notifications
You must be signed in to change notification settings - Fork 485
Fix issue #4213: trim the last char of the URL if it is a closing parenthesis #394
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
Conversation
YouTube trims any additional characters from |
Dear @wb9688, perhaps I was not clear enough. What I am trying to fix here is NewPipe's being unable to handle YouTube links which, inadvertedly, include a closing parenthesis at the end. To test it empirically, I invite you to open this very page in your favorite web browser for Android, and try to open with NewPipe each one of the two links below: the first shall work, whereas the second shall not (with And that's what I am trying to fix here by trimming the last character from the video's ID if that character is a closing parenthesis. Thank you for your attention. Please help me implement that fix. |
Try opening e.g. https://www.youtube.com/watch?v=mBuoZY7kAlgwhatever. Also note how with e.g. https://www.youtube.com/watch?list=PLEqQd15F3NFGFUYJhz8KvGNz-QDhJVynT&v=OGS7c0-CmRswhatever it will strip the other parameters. |
Dear friend, please watch me reproduce the issue with my Android device in Firefox for Android web browser: |
Again, YouTube strips any additional characters (and if there are additional characters, it will strip other parameters), while NewPipe considers the URL simply invalid, however this PR naively strips the last character if it's ), which is also incorrect as it should exactly follow YouTube's behavior. |
All right, as you wish |
@kirisakow He's talking about implementing the generic Youtube-like behaviour so it handles all cases of improper URLs, not just the parenthesis one. Did you close the PR because you don't wish to take that on? |
Dear @opusforlife2, @wb9688, I closed because l wasn't told what needs to be done — only that my solution was incorrect. If you are open to tell me what you think needs to be done — I'll do it. In the mean time, I don't want to spend my time guessing what you people expect me to do. |
Let me try to provide a clearer explanation, sorry for the confusion ;-)
Thank you for your contribution and sorry for the confusion ;-) |
Oh, forgot to add that you should keep this in mind while implementing: when the official browser version gets a video [didn't check other features] url with an id parameter |
I applied the suggested solution to the (As for the numerous reverts, they had to be done to clean all the side effects induced by the automatic formatter — which I eventually disabled) |
I'm not a dev so I can't comment on that aspect, but thank you for continuing to work on this. 🥂 |
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 looks better, thank you ;-)
I only pointed out a few style issues, but the overall approach is good. Add final
to all variables as you can, including function arguments.
...g/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeStreamLinkHandlerFactory.java
Outdated
Show resolved
Hide resolved
...g/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeStreamLinkHandlerFactory.java
Outdated
Show resolved
Hide resolved
...g/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeStreamLinkHandlerFactory.java
Outdated
Show resolved
Hide resolved
@Stypox Done |
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.
Please add one or two tests for urls with this longer-than-usual id (in YoutubeStreamLinkHandlerFactoryTest should do)
Thank you!
...g/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeStreamLinkHandlerFactory.java
Outdated
Show resolved
Hide resolved
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.
Thanks
...g/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeStreamLinkHandlerFactory.java
Outdated
Show resolved
Hide resolved
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.
Issues I pointed out still aren't fixed…
Even though you this does not handle urls exactly like youtube, like |
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 rebased on dev and run the tests again, everything works fine. Thank you!
@ TobiGr I can't merge due to other failing tests, could you do that? nevermind, I can
Fix #4213 issue
trim the last char of the URL if it is a closing parenthesis