0

When I try to use wget to download this image

http://www.imgbase.info/images/safe-wallpapers/anime/cowboy_bebop/6524_cowboy_bebop_hd_wallpapers.jpg

(and many from the same source), I get an html file with a .jpg extension instead of the actual jpg image.

I have tried the -A jpg option, no effect. I suspected I need to use the -U option with my firefox user agent info, still no difference.

  • Could you post the exact command(s) you tried? – Marc Vanhoomissen Sep 21 '17 at 13:43
  • @MarcVanhoomissen At first I tried the direct way wget [url], then I tried wget -A jpg [url] and wget -A.jpg [url] and then I even tried wget -r -p -A jpg [url], then I tried wget -U '[user agent]' -A jpg [url]. All of them did the exact same thing. – methereal42 Sep 21 '17 at 13:53
0

From a first impression it appears that they use cookies to ensure that you have viewed the page with all the ads etc. and then it is possible to download the image.

If you want to download it via a script you should save the session cookies one time and then resend those for the second request.

  • But I did download this image from cookie-disabled browser, so I'm guessing that's not it. – methereal42 Sep 21 '17 at 13:40
  • does the browser throw away the cookies immediately after use or does he not accept them at all? Another approach would be to use the chrome postman + postman interceptor to record curl queries and start from there. – noreabu Sep 21 '17 at 15:59
  • The browser does not accept cookies at all. Would you please explain the postman and curl part? I am not familiar with any of this. – methereal42 Sep 21 '17 at 17:13
  • [chrome.google.com/webstore/detail/postman/… is an chrome app and it has a [chrome.google.com/webstore/detail/postman-interceptor/… which can record HTML call. After you recorded your request, you can generate wget calls with it, when you click on "Code" on the right side and select whatever suits your needs. – noreabu Sep 21 '17 at 18:44
  • Ok I just tried that, I'm not sure what I did wrong but I copied the wget code from postman and pasted it into the terminal, nothing is downloaded but the HTML code of the page was printed in the terminal. Tried the curl code and got nothing at all. – methereal42 Sep 21 '17 at 20:16

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.