Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: Downloading posters from Amazon
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Jeremy Nicoll via curl-users <curl-users_at_cool.haxx.se>
Date: Fri, 15 Jan 2021 20:31:24 +0000
On Fri, 15 Jan 2021, at 00:30, John via curl-users wrote:
> All,
>
> I tried this once before and got lost. I have a list of home movies in
> a JSON file and I use the internet to retrieve movie data that goes
> into the JSON file. I then download the image poster from Amazon. I'm
> using ooREXX to do the work.
Before you try to use ooREXX you should experiment with curl commands
in a command/terminal window to find one that does what you need. It's
just possible that - as commands issued on Windows systems might need
quotes in various places, or escaped quotes (and other special characters
in them), that translating those into correct Rexx forms might not work as
you expect.
(I'm also a Regina REXX (a while ago) and ooREXX user, but haven't done
any curl stuff for a while.)
Your command seems to be
curl -L -O "theurl"
and you're using ooREXX's address system ... to trap the output?
Your -L parameter is telling curl to follow redirects to other servers if the
first server's initial response is not to return a file, but instead tell you to
look elsewhere. Just possibly that's complicating things. I'd usually prefer
to have my code see server responses, and thus know for itself if eg a
redirect is happening.
It would probably be better to tell curl explicitly what file you would like it
to write the fetched data to, and possibly also a separate file for any headers
that the server would have sent back preceding the image data.
After all, it's unlikely that (if you'd issued the curl command at a terminal/
command window) that you'd have wanted the binary contents of the JPG
to be written to the terminal command output.
So eg a curl command with
curl -L -o "C:\Users\John\Documents\IMDB\POSTERS\tt9625664.JPG" theurl
might work better. Note that that "-o" is a lowercase o.
You maybe need to skim read the list of options at:
https://curl.se/docs/manpage.html
> % Total % Received % Xferd Average Speed Time Time Time
> Current
> Dload Upload Total Spent Left
> Speed
> 100 24550 100 24550 0 0 24550 0 0:00:01 --:--:--
> 0:00:01 109k
>
> I don't really understand wht is going on and am not into CURL. Is the
> output showing that I downloaded 24550 bytes?
Yes. The following two zeros show nothing was uploaded.
> If so, then why does the
> file manager say I only downloaded zero.
You're possibly not looking in the right place? The meaning of -O (with
uppercase O) is maybe not doing what you expect.
I'm personally not in favour of using command-line tools that make
assumptions and read/write files into the current working directory,
and instead prefer to specify explicit full path names for any local
file I wish to use.
Date: Fri, 15 Jan 2021 20:31:24 +0000
On Fri, 15 Jan 2021, at 00:30, John via curl-users wrote:
> All,
>
> I tried this once before and got lost. I have a list of home movies in
> a JSON file and I use the internet to retrieve movie data that goes
> into the JSON file. I then download the image poster from Amazon. I'm
> using ooREXX to do the work.
Before you try to use ooREXX you should experiment with curl commands
in a command/terminal window to find one that does what you need. It's
just possible that - as commands issued on Windows systems might need
quotes in various places, or escaped quotes (and other special characters
in them), that translating those into correct Rexx forms might not work as
you expect.
(I'm also a Regina REXX (a while ago) and ooREXX user, but haven't done
any curl stuff for a while.)
Your command seems to be
curl -L -O "theurl"
and you're using ooREXX's address system ... to trap the output?
Your -L parameter is telling curl to follow redirects to other servers if the
first server's initial response is not to return a file, but instead tell you to
look elsewhere. Just possibly that's complicating things. I'd usually prefer
to have my code see server responses, and thus know for itself if eg a
redirect is happening.
It would probably be better to tell curl explicitly what file you would like it
to write the fetched data to, and possibly also a separate file for any headers
that the server would have sent back preceding the image data.
After all, it's unlikely that (if you'd issued the curl command at a terminal/
command window) that you'd have wanted the binary contents of the JPG
to be written to the terminal command output.
So eg a curl command with
curl -L -o "C:\Users\John\Documents\IMDB\POSTERS\tt9625664.JPG" theurl
might work better. Note that that "-o" is a lowercase o.
You maybe need to skim read the list of options at:
https://curl.se/docs/manpage.html
> % Total % Received % Xferd Average Speed Time Time Time
> Current
> Dload Upload Total Spent Left
> Speed
> 100 24550 100 24550 0 0 24550 0 0:00:01 --:--:--
> 0:00:01 109k
>
> I don't really understand wht is going on and am not into CURL. Is the
> output showing that I downloaded 24550 bytes?
Yes. The following two zeros show nothing was uploaded.
> If so, then why does the
> file manager say I only downloaded zero.
You're possibly not looking in the right place? The meaning of -O (with
uppercase O) is maybe not doing what you expect.
I'm personally not in favour of using command-line tools that make
assumptions and read/write files into the current working directory,
and instead prefer to specify explicit full path names for any local
file I wish to use.
-- Jeremy Nicoll - my opinions are my own. ----------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2021-01-15