Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Android Image CAPTCHA

Tags:

java

html

android

I'm having trouble with craigslist's login CAPTCHA. My program is trying to display the CAPTCHA image from the html source code. Any one know how you can get the CAPTCHA image link out of the source code? This is the script in their source code that displays the CAPTCHA. I can use there link and load another CAPTCHA and get that image, but what is need is the CAPTCHA image that is currently displayed. I can't find it though.

I know how to display it and everything I just need to find it.

//<![CDATA[
var RecaptchaOptions = {"tabindex":1,"theme":"clean"};
//]]>
</script>
<script src="https://www.google.com/recaptcha/api/challenge?
k=6Lf5YAcAAAAAAILdm73fp007vvmaaDpFb6A5HLJP" type="text/javascript"></script>

<noscript><iframe frameborder="0" height="300" 
src="https://www.google.com/recaptcha/api/noscript?
k=6Lf5YAcAAAAAAILdm73fp007vvmaaDpFb6A5HLJP" width="500"></iframe><br><textarea 
cols="40" name="recaptcha_challenge_field" rows="3"></textarea><input 
name="recaptcha_response_field" type="hidden" value="manual_challenge" /></noscript>
</p>
like image 1000
Xjasz Avatar asked Nov 13 '22 00:11

Xjasz


1 Answers

You can use a Java HTML DOM Parser library. I Recommend jsoup: Java HTML Parser.

  • Download the Library file from here and copy it into the libs folder of your android project.

Then you can use the following code to get the image site url

Document doc = Jsoup.parse(htmlString);
Element CaptchaFrame = doc.select("noscript > iframe").first();
String CpatchaImageUrl=CaptchaFrame.attr("src");
  • Now you can use that url as a source for an android WebView
like image 194
niranjan94 Avatar answered Nov 15 '22 12:11

niranjan94