Jump to content

How i can use loop on this type ?


Recommended Posts

Posted Image

<div class="photoItem">

<p class="photoNr"><a href="zdjecie,siedziba-blizzarda,3211,1.html">1</a></p>

<img src="stuff/blizzard/blizzard_01.jpg">

<p><small></small></p>

</div>

hi i am extracting image link from using below code

#Include <string.au3> #include <INet.au3> $Source = _INetGetSource("http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2=0&section=1&pages=100") $Between = _StringBetween($Source, '<img src="stuff/', '<p><small></small></p>') $file = FileOpen("C:\cd1.txt",1) FileWriteLine($file, $Between[0]) MsgBox(0, "Result", $Between[0])

#Include <string.au3>
#include <INet.au3>
;$Source = _"c:\cd.txt"
$Source = _INetGetSource("http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2=0&section=1&pages=100")
$Between = _StringBetween($Source, '<img src="stuff/', '<p><small></small></p>')
$file = FileOpen("C:\cd1.txt",1)
FileWriteLine($file, $Between[0])
MsgBox(0, "Result", $Between[0])

Now i am get fine result like

blizzard/blizzard_01.jpg">

and now my question is what type of loop i will use to get all images link like this [i know that there are 100 in number ]

Edited by ironmankho
Link to comment
Share on other sites

StringRegExp would be best, but if you haven't used it before, it can be difficult to learn. I recommend Expresso for newcomers. It helped me get started. Make sure you change the last parameter in StringRegExp so it returns an array of all the matches, not a 1 or a 0.

You may have to register for Expresso, but it doesn't cost anything.

Edited by dantay9
Link to comment
Share on other sites

Get a base URL (i.e, http://widelec.org/stuff )and concatenate the path to each file. Then download using InetGet.

You can also use wget.exe (google it, it's amazing).

sorry, the loop. Easy, get a collection of images to an array and download or do what you want.

; your page
$baseURL = 'http://widelec.org'
$url='http://widelec.org/index.php?site=blog&action=detail&text=&blog_id=3211&page2.. BLA BLA'
$oIE=_IECreate("about:blank")
_IENavigate(oIE ,)
$oImgs=_IEImgGetCollection ( $oIE, $url )
Dim $aImgs[1]
If StringInStr($oImg.src, 'stuff/blizzard/') Then
    ReDim $aImgs[UBound($aImgs)+1]
    $aImgs[UBound($aImgs)-1] = $baseURL&'\'&$oImg.src
EndIf
$aImgs[0]=UBound($aImgs)-1
Edited by ivan
Link to comment
Share on other sites

dantay9 , yes it is true StringRegExp is difficult to learn .... but thanks for your link

ThickOfIt

ind all text between divs. extract img url. repeat.

do until EOF

EOF prolly needs to be changed to proper term

Thanks for your advise ....i am newbie and try understand this ..but it will more help full me if you more explain ..please

ivan

your suggestion and code is awesome .... but using IEImgGetCollectionhave problem ..it download all images of web page than reply .instead i using INetget it only download source code of page and then exaime ..that is why i use this

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...