Jump to content
Sign in to follow this  
metis

Downloading src image in web

Recommended Posts

metis

I mean here to downloaded the src of the image and paste it to $ hrefs

Here is the code from image to download scr.

<div id="images" style="width: 300px; height: 57px; "><img style="display:block;" height="57" width="300" src="http://www.nk.pl/images/new"></div>

$hrefs = ... ;where (...) is the image src
Edited by metis

Share this post


Link to post
Share on other sites
sahsanu

I mean here to downloaded the src of the image and paste it to $ hrefs

Hello,

Here just an example:

$sText = '<div id="images" style="width: 300px; height: 57px; "><img style="display:block;" height="57" width="300" src="http://www.nk.pl/images/new"></div>'
$array = StringRegExp($sText,'(?i)src="(.*)"',1)
If @error Then
    ConsoleWrite("No matches found" & @CRLF)
Else
    $href = $array[0]
    ConsoleWrite("I've found this: " & $href & @CRLF)
EndIf

Above example will match only once, i.e. if there are more patterns (src="*") it will only match the first one... take a look to StringRegExp.

One more thing, if you need to get the source from the web page then take a peek to _INetGetSource.

Share this post


Link to post
Share on other sites
metis

UP @

The problem is that as operating on Firefox (_FF)

UP2 @ Thanks. How do I set it to read it just a picture.

xpath img =

/html/body/div[3]/div/div/div/div/a/img

Share this post


Link to post
Share on other sites
sahsanu

UP2 @ Thanks. How do I set it to read it just a picture.

xpath img =

/html/body/div[3]/div/div/div/div/a/img

Sorry but I don't understand what do you need.

Share this post


Link to post
Share on other sites
metis

I mean to look for from that moment the first image (src)

Share this post


Link to post
Share on other sites
sahsanu

I mean to look for from that moment the first image (src)

Please, paste a real example so I can figure out how to try to solve your issue.

Share this post


Link to post
Share on other sites
metis

Me all code

#include <ff.au3>
#include <string.au3>
_FFConnect()
_FFStart("www.nk.pl")

$sText = _FFReadHtml()
;There needs to look for from the moment that is /html/body/div[3]/div/div/div/div/a
$array = StringRegExp($sText,'(?i)src="(.*)"',1)
If @error Then
    ConsoleWrite("No matches found" & @CRLF)
Else
    $href = $array[0]
    ConsoleWrite("I've found this: " & $href & @CRLF)
EndIf
;It is the task I see logos servisu scr
Edited by metis

Share this post


Link to post
Share on other sites
sahsanu

Hi again,

If the image you need to get is "http://0.s-nk.pl/img/new_logo_standard_2010" then change your script:

From:

$array = StringRegExp($sText,'(?i)src="(.*)"',1)

To:

$array = StringRegExp($sText,'(?i)img src="(.*?)"',1)

Share this post


Link to post
Share on other sites
metis

Never mind. I need to begin looking for the given object

/ / html / body / div [3] / div / div / div / div / a

know how to do it?

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  

×