Grabbing An Image URL From Webpage

PutterPlace

Active member
Joined
Feb 18, 2008
Messages
37
Programming Experience
1-3
I am working on a small project for testing purposes. All I want to be able to do is get an image URL from a webpage. The only problem that I'm having is that I cannot find the image URL within the HTML. Here is the URL from which I'm attempting to get the image from:

VB.NET:
http://www.stumbleupon.com/sign_up.php

When right-clicking in Firefox and choosing "View Image", it shows that the image URL is as follows:

VB.NET:
http://api.recaptcha.net/image?c=A_BUNCH_OF_STUFF_HERE

After examining the HTML for a little bit, I've come up with the conclusion that the image is generated from JavaScript:

VB.NET:
http://api.recaptcha.net/js/recaptcha_ajax.js


I know there must be some way to grab the image URL. Any help would be greatly appreciated. :)
 
Easiest is loading it into a WebBrowser control (visible or not) and use the Html DOM tree to get it:
VB.NET:
Dim url As String = Me.WebBrowser1.Document.GetElementById("recaptcha_image").FirstChild.GetAttribute("src")
By the way, the image is inserted by Javascript and you can't even find it in Document.Images collection after page is loaded.

I also browsed through their terms of use and didn't find anything prohibiting looking into this.
 
I will definitely try that out really quick. Thanks for your quick help. :)

EDIT: This worked perfectly. Thank you SO much. :)
 
Last edited:
Back
Top