Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

wget is a very useful tool to download stuff on the internet quickly, but can I use it to download from hosting sites, like FreakShare, IFile.it Depositfiles, Uploaded, Rapidshare? If so, how can I do that?

share|improve this question
4  
Don't most of those sites tend use javascript and other barriers to eliminate linking directly to the files? –  Tim Jul 13 '12 at 17:08
    
@Tim I think you are correct, because it's impossible to get a direct link from those sites. –  Zignd Jul 14 '12 at 14:54
    
@swift Could you please translate it to english and post on pastebin or somewhere else –  Zignd Jul 14 '12 at 18:20

2 Answers 2

up vote 5 down vote accepted

This kind of site tries to make it difficult not to use a graphical web browser, because if you use wget you'll be missing all these ads that pay for the bandwidth.

Some sites don't make advanced checks and can be tricked easily: tell wget to pretend that it's really Mozilla and that it's coming from the download site.

wget --user-agent='Mozilla/5.0 (Windows NT 6.0) Gecko/20100101 Firefox/14.0.1' \
     --referer=http://downloadsite.example.com/download-page-url
     http://downloadsite.example.com/download-page-url/filename.ext`

Most sites that check let you get away with --user-agent=Mozilla and --referer set to the URL of the file you're downloading.

With some sites, you might need to export the web browser cookies and pass --load-cookies to wget; at this point using wget starts to be more work than a manual download. The ultimate method, which can work all the time but requires some coding for each site, is to use a browser automation framework such as Selenium or Watir.

See also Does anybody here have experience in automating some tasks in web applications using curl?

share|improve this answer
    
Awesome! Your answer helped me write this for Zippyshare Links: stackoverflow.com/a/21100640/1533054 –  Sheharyar Jan 13 at 20:23

For Zippyshare:

This method builds up on Gilles' answer. Like he said, the trick is to make the server think that the request is being made from a browser and to make that happen, you need a couple of things:

  • The Download Link (The actual link to the file)
  • Link Referrer (The webpage with the download button)
  • Zippyshare Session ID (Found in Cookies)

Here's a screenshot explaining where you can get each item:

Download From Zippyshare

Now open up your terminal, and use the following command (replacing necessary items):

wget <download_link> \
--referer='<referrer>' \
--cookies=off --header "Cookie: JSESSIONID=<session_id>" \
--user-agent='Mozilla/5.0 (Windows NT 6.0) Gecko/20100101 Firefox/14.0.1'

Example:

wget http://www16.zippyshare.com/d/29887835/8895183/hello.txt \
--referer='http://www16.zippyshare.com/v/29887835/file.html' \
--cookies=off --header "Cookie: JSESSIONID=26458C0893BF69F88EB5743D74FE0F8C" \
--user-agent='Mozilla/5.0 (Windows NT 6.0) Gecko/20100101 Firefox/14.0.1'

Note: In the command, it is in fact referer not referrer

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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