-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix ReCaptcha activity and correctly save obtained cookies #3035
Conversation
I car confirm it's fixing fine #2979. |
This should be quite easy. Maybe we can pass either some js to the webview after loading the site. For converting R.color ids which are used in the themes to hex, you might use the the |
@B0pol I am not sure it is safe to change the background of the webview. It would surely require some (potentially slow) JavaScript code to be run, and it could create graphical problems on complex recaptcha pages (I use an extension to change colors on my Firefox ("Dark Background and Light Text"), but on some websites it doesn't work properly). |
Even if the page didn't auto-close
I'm testing the apk file attached to the first comment but it doesn't fix my problems with YT captchas. I always get a captcha when I try to watch a YT video. I solve the captcha and can watch the video in the webview of NewPipe. I press ✔️ when I solve the captchas but then I get again another captcha with the next video which I watch. |
@juanfra684 could you test this apk, based on the last commit? If even the apk above doesn't work, please use the following one. When you press :heavy_check_mark (after solving) it throws an error on purpose (so that I can see the content of cookies): please paste the bug report content here. |
@TobiGr this is how the Activity looks like now. Is it ok? I decided to move the button to the right for better UI, since it's an action. |
app-debug_1.zip is corrupted. I can extract the apk but I can't install it. app-debug_2.zip installs fine. |
@juanfra684 Could you try again with this apk (as a replacement for app-debug_1.zip)? Thank you :-) |
I've the same problems with the new apk. This is the output of app-debug_2 with the captcha solved:
|
Do you mean that you're not able to install it, or that solving the recaptcha does nothing? @juanfra684
Thank you :-) |
I can install it but YT always shows a captcha with every video. I can watch any video within the webview after of solve the first captcha, so my IP is not blacklisted. The problem only happens when I go to a video from NewPipe directly. I've tried a few times solving the captchas and touching ✔️ but YT stills shows captchas with every new video. |
@juanfra684 |
Don't worry. NewPipe is one of my favorite apps, I've not problem helping to test the fixes. Looks like your last commit fixed the problem. I only was asked to solve the captcha one time. After that everything worked as usual. Thanks a lot for fixing this! |
Thank you very much for testing! |
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! Looks good to me
For reference in the future, there's a very easy way to get reCAPTCHAs to test this issue: route your traffic through tor or any popular free proxy. Chances are good that a abuser/spammer already made it blacklisted. But this appears to have fixed it. PS: One thing though that was already mentioned, we are setting the cookies for EVERY request, even for those that the service don't use it, what about we don't do that? Maybe something like a cookie jar for services? I think this could be done before the next release. |
How can I route my NewPipe's traffic through tor? @mauriciocolli |
Thanks |
Description
This pr aims to solve the many issues regarding the ReCaptchaActivity. In #2527 I tried to fix it, though I was unable to test the changes since I couldn't reproduce any ReCAPTCHAs anymore, so it kept crashing. After @B0pol in #2979 provided a way to reproduce, I was able to redesign the activity. Before the cookies were extracted from the page on close, but unfortunately this didn't imply that the captha was solved, since there could have been redirections or the page didn't close on resolution. Now the user is provided with a "Done" button to press when he finishes solving the captcha, that sets the cookies to the downloader.
Sometimes services return a recaptcha challenge error code (429) just to indicate Too Many Requests, so in that case the ReCaptchaActivity is opened, but the only thing the user has to do is press "Done" since there are no recaptchas to solve.
This is the only scenario I was able to test, and I am confident the Youtube cookie extraction method works since I didn't change it,(it didn't work, but it should be fixed now)though I am not entirely sure that the(now it is always called on close).handleCookies
function is always called (someone who knows howWebViewClient
s work?).Also renamed some recaptcha-related strings to have them match the naming conventions, leading to many changed strings.xml files.
Follow-ups for next pull requests
Maybe we should keep a hash-table with all cookies and their values and update that table every time we need, instead of overwriting the whole cookie string every time. Since, for now, the only service with recaptchas is YouTube, there is no problem to always overwrite the old Downloader cookies, but for the future we might need to change this.
Anyway in the
handleCookies
function I left the space for other services (other than Youtube) to try and extract cookies.Fixes & debug apk
Fixes #3023 fixes #2979 fixes #2924 fixes #2788 fixes #2484
Debug apk: app-debug.zip