Home All Groups Group Topic Archive Search About
Author
1 Apr 2006 11:47 AM
Peter Eriksson
I have made an application that downloads images from a website with
code like this:

Dim Client As WebClient = New WebClient()
imageUrl = http://www.websíte.com/image.jpg
Client.DownloadFile(imageUrl, dest)

This works fine but the website returns a defaultimage if the image is
adressed with a complete url. You have to first wisit the mainpage and
then you can adress the image.
How can I achive this?

Author
1 Apr 2006 12:18 PM
Cor Ligthert [MVP]
Peter,

It is not impossible that the image is protected in a database.

Be aware that you are hacking when you try to get protected data from a
webserver.
At least in my country is there a penalty for that.

Cor

Show quoteHide quote
"Peter Eriksson" <peter.eriksson.***@telia.com> schreef in bericht
news:O2wjbIYVGHA.5288@TK2MSFTNGP14.phx.gbl...
>I have made an application that downloads images from a website with
> code like this:
>
> Dim Client As WebClient = New WebClient()
> imageUrl = http://www.websíte.com/image.jpg
> Client.DownloadFile(imageUrl, dest)
>
> This works fine but the website returns a defaultimage if the image is
> adressed with a complete url. You have to first wisit the mainpage and
> then you can adress the image.
> How can I achive this?
>
>
>
>
Author
2 Apr 2006 8:20 PM
Peter Eriksson
No, I don't think it is hacking.
It is a public page. You can easily download
the pictures with rightclick in the browser.
It was just a testproject to learn about the WebClient class.


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> skrev i meddelandet
news:%23H6huYYVGHA.1204@TK2MSFTNGP12.phx.gbl...
> Peter,
>
> It is not impossible that the image is protected in a database.
>
> Be aware that you are hacking when you try to get protected data from a
> webserver.
> At least in my country is there a penalty for that.
>
> Cor
>
> "Peter Eriksson" <peter.eriksson.***@telia.com> schreef in bericht
> news:O2wjbIYVGHA.5288@TK2MSFTNGP14.phx.gbl...
>>I have made an application that downloads images from a website with
>> code like this:
>>
>> Dim Client As WebClient = New WebClient()
>> imageUrl = http://www.websíte.com/image.jpg
>> Client.DownloadFile(imageUrl, dest)
>>
>> This works fine but the website returns a defaultimage if the image is
>> adressed with a complete url. You have to first wisit the mainpage and
>> then you can adress the image.
>> How can I achive this?
>>
>>
>>
>>
>
>
Author
3 Apr 2006 7:16 AM
gene kelley
On Sun, 2 Apr 2006 22:20:14 +0200, "Peter Eriksson"
<peter.eriksson.***@telia.com> wrote:

Show quoteHide quote
>No, I don't think it is hacking.
>It is a public page. You can easily download
>the pictures with rightclick in the browser.
>It was just a testproject to learn about the WebClient class.
>
>
>"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> skrev i meddelandet
>news:%23H6huYYVGHA.1204@TK2MSFTNGP12.phx.gbl...
>> Peter,
>>
>> It is not impossible that the image is protected in a database.
>>
>> Be aware that you are hacking when you try to get protected data from a
>> webserver.
>> At least in my country is there a penalty for that.
>>
>> Cor


If simply downloading for personal use, via browser or app, there is
no problem.  However, if in an application that ultimately downloads
and displays images form a website and the app is to be distributed,
it's best to check the website(s) to see if there is any copyright
restrictions or premissions required.

Gene
Author
3 Apr 2006 7:06 AM
gene kelley
On Sat, 1 Apr 2006 13:47:07 +0200, "Peter Eriksson"
<peter.eriksson.***@telia.com> wrote:

>I have made an application that downloads images from a website with
>code like this:
>
>Dim Client As WebClient = New WebClient()
>imageUrl = http://www.websíte.com/image.jpg
>Client.DownloadFile(imageUrl, dest)
>
>This works fine but the website returns a defaultimage if the image is
>adressed with a complete url. You have to first wisit the mainpage and
>then you can adress the image.
>How can I achive this?
>
>
>
On the mainpage, right-click the image, properties, and see what the
actual URL is to the image. That URL should retrive the correct image
if the image is static, or, it's an image that is updated periodically
but has an static file name of something like .. /latest.jpg.  If it's
an updating image and has an ultimate filename that is based on
something like date/time, you will have to predetermine the current
URL (i.e. a parseHTML routine of some sort)

If VB2005 and you just want to write to disk, you can also use this
with it's various arguments:
My.Computer.Network.DownloadFile(someURL, someDest)


Gene
Author
3 Apr 2006 11:48 AM
Andrew Morton
Peter Eriksson wrote:
> I have made an application that downloads images from a website with
> code like this:
>
> Dim Client As WebClient = New WebClient()
> imageUrl = http://www.websíte.com/image.jpg
> Client.DownloadFile(imageUrl, dest)
>
> This works fine but the website returns a defaultimage if the image is
> adressed with a complete url. You have to first wisit the mainpage and
> then you can adress the image.
> How can I achive this?

Might it be that the web site checks the referer (sic) property when serving
images in order to prevent what you're trying to do? (Although I don't know
if referer would be set by making a request through .NET.) If you try it on
a web server that you control, does it work as desired first time? You can
also look at the logs for clues.

Just because a URL ends in .jpg doesn't mean that it came directly from the
file - there could be a filter inbetween.

Andrew