Advertisement
Guest User

Untitled

a guest
Feb 4th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. WebView myWebView = (WebView) getActivity().findViewById(R.id.webview);
  2. myWebView.setWebViewClient(new WebViewClient() {
  3.     public boolean shouldOverrideUrlLoading(WebView view, String url) {
  4.         view.loadUrl(url);
  5.         // this fires when the IUAM navigated to the captcha JSON
  6.         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  7.             view.evaluateJavascript(
  8.                 "(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();",
  9.                 new ValueCallback < String > () {
  10.                     @Override
  11.                     public void onReceiveValue(String html) {
  12.                         // here is the logic for captcha getting
  13.                         System.out.println(html);
  14.                     }
  15.                 });
  16.         }
  17.         return false;
  18.     }
  19. });
  20.  
  21. // should be non-browser otherwise it will never complete. use for example fourchan/1.0
  22. myWebView.getSettings().setUserAgentString(UserAgentProvider.getInstance().getUserAgent());
  23. myWebView.setHorizontalScrollBarEnabled(true);
  24. myWebView.setVerticalScrollBarEnabled(true);
  25. WebSettings webSettings = myWebView.getSettings();
  26. webSettings.setJavaScriptEnabled(true);
  27. // notice that user should make a gesture.
  28. myWebView.loadUrl("https://sys.4chan.org/captcha?board=b");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement