ironmankho Posted October 15, 2009 Posted October 15, 2009 (edited) <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§ion=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§ion=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 October 15, 2009 by ironmankho
dantay9 Posted October 15, 2009 Posted October 15, 2009 (edited) 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 October 15, 2009 by dantay9
ThickOfIt Posted October 15, 2009 Posted October 15, 2009 find all text between divs. extract img url. repeat. do until EOF EOF prolly needs to be changed to proper term
ivan Posted October 15, 2009 Posted October 15, 2009 (edited) 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 October 15, 2009 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
ironmankho Posted October 16, 2009 Author Posted October 16, 2009 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 EOFEOF prolly needs to be changed to proper termThanks for your advise ....i am newbie and try understand this ..but it will more help full me if you more explain ..please ivanyour 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now