|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Download from webI 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? 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? > > > > 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? >> >> >> >> > > 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. If simply downloading for personal use, via browser or app, there is>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 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 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 On the mainpage, right-click the image, properties, and see what the>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? > > > 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 Peter Eriksson wrote:
> I have made an application that downloads images from a website with Might it be that the web site checks the referer (sic) property when serving > 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? 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
Option Strict On
disabling controls by checking off a radio button when the form loads View a file in Hex Currently logged in user's email Format function... Confused! Check Interface Implementation of a Type Get a simple handler Invoking CTRL+C,X,V programatically Double-Buffering in VB2005? save string var to html file without losing format |
|||||||||||||||||||||||