[std.net.curl] Downloading multiple files using download()
Jack via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Dec 27 22:51:14 PST 2014
On Sunday, 28 December 2014 at 06:26:18 UTC, ketmar via
Digitalmars-d-learn wrote:
> On Sun, 28 Dec 2014 06:14:09 +0000
> Jack via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> I'm trying to create a sort of "downloader" where it will
>> download multiple pages of "comics" which are in ".jpg"
>> format. Now the problem is, that when I used the "download()
>> function":
>> >download(url, location);
>> Where:
>> url = direct link to the image
>> location = "/downloads/" ~ to!string(x) ~ ".jpg"; (x is the
>> page number)
>>
>> It would spew out an error code:
>> > std.stream.OpenException at std/stream.d(50): Cannot open or
>> > create file >'/downloads/1.jpg'
>>
>> I dug around to see that nothing but the documentation page
>> has an example for this, but unfortunately it was only for one
>> file.
>>
>> So can anyone help me?
>>
>> Note: I can't get the url here since the url is a little bit
>> "NSFW"
> you are trying to write the file to "/download" directory, that
> obviously doesn't exist.
>
> `url` arg is the FULL url -- the one that you'll pass to wget to
> download the picture. and `location` is the DISK location of the
> resulting file (i.e. the file that will be created). as you are
> passing
> the absolute path for it, it starts searching from the root
> directory.
>
> now remove that pesky '/' at the start of the `location` and
> give us
> the link, as NSFW comics are specially good at sundays! ;-)
As much as my brotherhood senses push me into revealing the
links(they're in json), doing that will reveal my guilty
pleasures and fetishes. Well, anywho, thanks for that. I
appreciate it.
More information about the Digitalmars-d-learn
mailing list