Jump to content
Sign in to follow this  
bluerein

Image downloads

Recommended Posts

bluerein

Im using _IEImgGetCollection to download a web pages images... What ive found is that _IEImgGetCollection scans the page source and only gets them images in the source ...Is there another way to download every image on the page..

thanks

Share this post


Link to post
Share on other sites
PsaltyDS

Im using _IEImgGetCollection to download a web pages images... What ive found is that _IEImgGetCollection scans the page source and only gets them images in the source ...Is there another way to download every image on the page..

thanks

The _IE* functions work on the DOM, not the source, which is not quite the same thing.

Can you post an example of _IEImgGetCollection() NOT getting all the images?

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
bluerein

sure..

#include <IE.au3>
#include <INet.au3>
$loc= @DesktopDir
$site="http://www.invisiontuning.com/forum/"
sleep(500)
$oIE = _IECreate ($site,1,0)
$oImgs = _IEImgGetCollection ($oIE)
$iNumImg = @extended
    MsgBox(0,"",$iNumImg & "imagaes found")
sleep(500)
For $oImg In $oImgs
    $path = StringReplace($oImg.src,$site & "style_images/",$loc & "\images\")
    $File = StringMid($oImg.src, StringInStr($oImg.src, "/", 0, -1)+1)
    $dir =  StringReplace($path,$file,"")
    $dir2= StringReplace($dir,"/","\")
    DirCreate($dir2)
    sleep(100)
    If not FileExists($dir2 & $file) then InetGet($oImg.src, $dir2 & $file, 1, 0)
Next
    _IEQuit ($oIE)

just run it!!

It says 69 images found (does that include duplicates?) it only gets about 25 or so and if you look at the page there loads its missed

Share this post


Link to post
Share on other sites
PsaltyDS

sure..

#include <IE.au3>
#include <INet.au3>
$loc= @DesktopDir
$site="http://www.invisiontuning.com/forum/"
sleep(500)
$oIE = _IECreate ($site,1,0)
$oImgs = _IEImgGetCollection ($oIE)
$iNumImg = @extended
    MsgBox(0,"",$iNumImg & "imagaes found")
sleep(500)
For $oImg In $oImgs
    $path = StringReplace($oImg.src,$site & "style_images/",$loc & "\images\")
    $File = StringMid($oImg.src, StringInStr($oImg.src, "/", 0, -1)+1)
    $dir =  StringReplace($path,$file,"")
    $dir2= StringReplace($dir,"/","\")
    DirCreate($dir2)
    sleep(100)
    If not FileExists($dir2 & $file) then InetGet($oImg.src, $dir2 & $file, 1, 0)
Next
    _IEQuit ($oIE)

just run it!!

It says 69 images found (does that include duplicates?) it only gets about 25 or so and if you look at the page there loads its missed

Excellent answer! Short, complete, and presumably demonstrates your issue! :mellow:

I don't try out unfamiliar web sites from "Windowsland" here, but when I get to one of my safe machines I'll try it out. Others may be able to check it quicker than that.

:(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
PsaltyDS

When I run this, I get 69 images and their .src strings. How many were you looking for?

#include <IE.au3>
#include <INet.au3>

$site = "http://www.invisiontuning.com/forum/"
$oIE = _IECreate($site, 1)
$oImgs = _IEImgGetCollection($oIE)
$iNumImg = @extended
ConsoleWrite($iNumImg & "imagaes found" & @LF)
$n = 0
For $oImg In $oImgs
    ConsoleWrite("Index " & $n & ":  " & $oImg.Src & @LF)
    $n += 1
Next

:mellow:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
bluerein

yes 69 is wrong though ... theres more that its not getting...why??

example

theres an image called "cathead_right.gif" on the page

I used this to view the image names as it looped

#include <IE.au3>
#include <INet.au3>
$loc= @DesktopDir
$site="http://www.invisiontuning.com/forum/"
sleep(500)
$oIE = _IECreate ($site,1,0)
$oImgs = _IEImgGetCollection ($oIE)
$iNumImg = @extended
    MsgBox(0,"",$iNumImg & "imagaes found")
sleep(500)
For $oImg In $oImgs
    $path = StringReplace($oImg.src,$site & "style_images/",$loc & "\images\")
    $File = StringMid($oImg.src, StringInStr($oImg.src, "/", 0, -1)+1)
     MsgBox(0,"",$file)
Next
    _IEQuit ($oIE)

no "cathead_right.gif" returned!!

So its missing images then...

Share this post


Link to post
Share on other sites
bogQ

dont see how 69 is wrong.

theres an image called "cathead_right.gif" on the page

no "cathead_right.gif" returned!!

where?

i opened page source and on ctrl+f dident finde that picture

can you post ss to see where is located that picture from invisiontuning site pls?


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
bogQ

whell tellme how do you plan to get something what you cant get with normal methods, is not in source, its not saved with save as html, it cant b selected with ctrl+a it dont have proporties.

what you see is imported from heare

http://www.invisiontuning.com/forum/style_images/css_6.css

so basicly its not picture from that page even if you see it on it

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
bluerein

yes I know all that ...

So weve established then that _IEImgGetCollection doesnt get what we see...thats all I nedded to know ...thanks

Share this post


Link to post
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
Sign in to follow this  

×