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>
You can use a Java HTML DOM Parser library. I Recommend jsoup: Java HTML Parser.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With