Jump to content

URL Get Images - Captcha - _IEImgGetCollection


Recommended Posts

Hi...

I have a questions regarding the _IEImgGetCollection function. I have the code implemented below, and I am getting the results saved to c:\foo as expected. There is a captcha image (properties from IE attached below) that isn't being downloaded. Its the real image that I need. The code of the webpage for this particular part is:

My questions:

Am I missing something to grab this image?

Is there a better way to grab just that image?

IE Source

<table style="margin-left: 220px;">

<tr>

<td>

<b>Text:</b> <a class="tiny ul" href="http://apps.facebook.com/fishwrangler/my?captcha=refresh" requirelogin="true" onclick="(new Image()).src = '/ajax/ct.php?app_id=8138090269&amp;action_type=3&amp;post_form_id=f339edd6a2eebdbc900163bae4a27b92&amp;position=3&amp;' + Math.random();return true;">refresh?</a>

</td>

<td style="padding-left: 50px;">

<b>Retype 3 letters in center: <span class="tiny red">required</span></b>

</td>

</tr>

<tr>

<td>

<img style="border: 1px solid #bdc7d8;" src="http://fb.fishwranglr.com/content/captcha/uid/1533592366?t=1250376477" />

</td>

<td style="padding-left: 50px;">

<input type="text" name="text" class="huge inputtext" maxlength="3" style="width: 80px;" />

<input type="submit" value="Go!" class="huge" />

</td>

</tr>

</table>

AutoIt Code (Thanks Dale, and AutoIt Forums)

func treasure()
    $sImgDir = "c:\foo\"; Please make certain this folder already exists (silent failure if not)
    ;$oIMGs = _IEImgGetCollection($oIE, "img")
    $oIMGs = _IEImgGetCollection($oIE)
    ; Loop through all IMG tags and save file to local directory using INetGet
        
    For $oIMG in $oIMGs
        $sImgUrl = $oIMG.src
        $sImgFileName = $oIMG.nameProp
        INetGet($sImgUrl,  $sImgDir & $sImgFileName)
    Next
EndFunc

IE Properties of image can be seen here:

http://www.neweasyrecipe.com/downloads/pic.jpg

Edited by Iceburg
Link to comment
Share on other sites

When you do an InetGet you are making another connection to the server and most likely a new image is being served up.

Unfortunately, I have no desire to help you defeat a captcha. I think that it a resonable and relatively unobtrusive way to protect content and prevent spam and abuse. I shudder to think how bad the next mechanism will be once captchas are no longer effective.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

It is creating a new connection to the server, but the image stays the same. The image is just never downloaded. I am not asking you to help me defeat anything, the issue is about the Auto It code and why its not downloading that specific image. The image is going to get e-mailed to me, and I will respond with the code that it needs from my phone.

Edited by Iceburg
Link to comment
Share on other sites

For anyone else that cares, I got around it like this:

$sImgFileName = "captcha.jpg"
$sImgDir = "c:\foo\"
$SourceImg = StringRegExp(_IEPropertyGet($oIE, "innerhtml"), '"(http://fb.fishwranglr.com/content/captcha/uid/\d+\?t\=\d+)', 1) 
;MsgBox(0, "URL", "Url is " & $SourceImg[0])
INetGet($SourceImg[0], $sImgDir & $sImgFileName)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...