3

Using curl, I am attempting to download a PDF to my drive. However, the resulting file is only 210 bytes and cannot be opened!

curl -O 'https://www.wisdomtree.eu/en-ie/-/media/eu-media-files/key-documents/kids/etf-securities/kid---de000a1rx996---wisdomtree-physical-gold---eur-daily-hedged---en.pdf'

When I download the PDF with Google Chrome, the actual resulting file is 240 Kb and can be opened successfully.

It seems like curl is only getting some meta data – not the entire PDF:

<html>
<head>
<META NAME="robots" CONTENT="noindex,nofollow">
<script src="/_Incapsula_Resource?SWJIYLWA=5074a744e2e3d891814e9a2dace20bd4,719d34d31c8e3a6e6fffd425f7e032f3">
</script>
<body>
</body></html>%   

I tried solving this with a few variants, including curl -O -J -L and some other things, and I also tried with wget – but I constantly seem to run into the same problem.

(I'm assuming that the server may be doing something with a blob URL, streaming, or redirect, I'm however unsure how to deal with this).

2
  • 1
    Are answers on this question perhaps helpful? Jun 22, 2020 at 12:27
  • @SaaruLindestøkke Thank you, I have updated an answer to my question using information from that link.
    – P A N
    Jun 22, 2020 at 13:01

1 Answer 1

2

After looking at this suggestion on Unix & Linux Stack Exchange, I could copy a functioning cURL from Google Chrome's View > Developer > Developer Tools > Network tab by reloading the URL with the Network tab open, and right-clicking the appearing .pdf in the file list and choosing Copy > Copy as cURL.

The copied cURL command includes several options, but I found that the server seems to require only the addition of the -H 'cookie: <cookie data here>' option.

curl -H 'cookie: <cookie data here>' -O 'https://www.wisdomtree.eu/en-ie/-/media/eu-media-files/key-documents/kids/etf-securities/kid---de000a1rx996---wisdomtree-physical-gold---eur-daily-hedged---en.pdf'

I am assuming this requires me to browse to the website first and actually obtain a session cookie. I am not sure if retrieval can be accomplished without one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .