Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using wget to download a ZIP file

Tags:

ssh

server

wget

vps

I'm having trouble using wget for my Debian 7.0 VPS server hosted by OVH.

I'm trying to download a ZIP file from MediaFire, and when I connected via SSH I typed,

wget http://download1472.mediafire.com/5ndlsskkyfmg/dgx7zbbdbxawbwd/Vhalar-GGJ16.zip

Then, this is my output,

--2016-03-07 20:17:52--  http://download1472.mediafire.com/5ndlsskkyfmg/dgx7zbbd                                                                         bxawbwd/Vhalar-GGJ16.zip
Resolving download1472.mediafire.com (download1472.mediafire.com)... 205.196.123                                                                         .160
Connecting to download1472.mediafire.com (download1472.mediafire.com)|205.196.12                                                                         3.160|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.mediafire.com/?dgx7zbbdbxawbwd [following]
--2016-03-07 20:17:52--  http://www.mediafire.com/?dgx7zbbdbxawbwd
Resolving www.mediafire.com (www.mediafire.com)... 205.196.120.6, 205.196.120.8
Connecting to www.mediafire.com (www.mediafire.com)|205.196.120.6|:80... connect                                                                         ed.
HTTP request sent, awaiting response... 301
Location: /download/dgx7zbbdbxawbwd/Vhalar-GGJ16.zip [following]
--2016-03-07 20:17:52--  http://www.mediafire.com/download/dgx7zbbdbxawbwd/Vhala                                                                         r-GGJ16.zip
Connecting to www.mediafire.com (www.mediafire.com)|205.196.120.6|:80... connect                                                                         ed.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `Vhalar-GGJ16.zip'

    [  <=>                                  ] 94,265       440K/s   in 0.2s

2016-03-07 20:17:52 (440 KB/s) - `Vhalar-GGJ16.zip' saved [94265]

The download took less than 1 second, and it's a 280MB zip file. Also, it seems to say "440 KB/s", and that math just doesn't add up.

I'm confused as to why I can't download this zip file to my server via SSH, instead of downloading it to my computer, then re-uploading it to the server.

Does anyone see a flaw I'm making in my command?

like image 244
Logan Butler Avatar asked Mar 08 '16 01:03

Logan Butler


2 Answers

What you're doing when you're using wget to download that zip file is just downloading the html page that the zip file sits on. You can see this because if you redo the command to output to an html file like such:

wget http://download1472.mediafire.com/5ndlsskkyfmg/dgx7zbbdbxawbwd/Vhalar-GGJ16.html

and open it in the web browser of your choice, you'll get the fancy html page of that link with the mediafire download button on it.

This is entirely because mediafire wants you to verify that you're human with a captcha before you can download it. Try doing the captcha and then issuing the command:

wget http://download1472.mediafire.com/gxnd316uacsg/dgx7zbbdbxawbwd/Vhalar-GGJ16.zip

It will work.

If you have not completed the captcha on whatever computer you're trying to download it from, you need to. This is what the captcha originally looks like. Once you finish it and click "Authorize Download" you'll have free reign to wget the file from the server.

Mediafire Captcha

If all else fails, download it originally on your computer and use the scp command to transfer it over.

like image 81
Chirality Avatar answered Sep 20 '22 14:09

Chirality


Look at the contents of the 94kb file that you downloaded in something like vi. Odds are it's not a zip file, but a html file, telling you what went wrong, and what you need to do to download the file.

A browser would have known this (the mime type would tell it that it is being served HTML, and it would display it to you rather than download it).

It is likely that this is a measure by Mediafire to prevent automated downloads of their files. It's possible that spoofing the user-agent header might help, but unlikely.

like image 40
Dewi Morgan Avatar answered Sep 20 '22 14:09

Dewi Morgan