I am typing the command

wget http://bookfi.org/dl/1029034/ad9e54

in bash and I don't get the file, instead i get an html page.

If I give the same link to freedownloadmanager, it does fetch the file.

Why is this behaviour?

Can curl fetch me the file?


The link you're using (http://bookfi.org/dl/1029034/ad9e54) isn't a direct link to the file. When I opened it in Firefox, it redirected me to the much longer http://dl.lux.bookfi.org/genesis/408000/7def946a9159159e60931e25e71f23eb/_as/%5BCommittee_on_Advanced_Engineering_Environments,_N(BookFi.org).pdf, which is what you have to feed into the wget command.

The reason it worked for freedownloadmanager was probably because it has a facility which lets it follow redirects. I don't know about curl; it'll depend on whether it follows redirects or not.

  • Then, is it possible to make a script that redirects? – shooting-squirrel Apr 16 '14 at 6:13
  • 1
    According to the wget man page,there is a --referer=*url* option, where *url* is the page you got the download link from. This is to be used for dynamic websites which expect people to be using web-browsers and don't work properly unless they know which page you came from. It seems to work for the link you gave in the question: wget "http://bookfi.org/dl/1029034/ad9e54" --referer="http://en.bookfi.org/book/1029034" – Hippo Apr 16 '14 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.