Friday, February 26, 2010

WGet for Premium Accounts

Getting contents on the NAS with Megaupload or Rapidshare using your premium accounts is great and very easy to do with a terminal. The overhead is very low and here is how all done.

Will need GNU Wget and that allows files to be downloaded using (megaupload) and(rapidshare).

First thing you will need to do is grab your cookies for your premium accounts. Replace USERNAME and PASSWORD with your accounts details:

1. wget --save-cookies ~/.cookies/rapidshare --post-data "login=USERNAME&password=PASSWORD" -O - https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi > /dev/null
2. wget --save-cookies .megaupload --post-data "login=1&redir=1&username=USERNAME&password=PASSWORD" -O - http://megaupload.com/?c=login > /dev/null

This saves a cookie for each account into your hidden cookie folder... run ls ~.cookies to make sure they're there if you want.

Do note that the account need to be enabled with "Direct Download" enable.

Believe it or not, that's the hard work done... now for the download just use the following replacing URI with the download link:

1. wget -c --load-cookies .megaupload URI
2. wget -c --load-cookies .cookies/rapidshare URI

If you have problems with the megaupload downloads, login to your accoutn and make sure that the direct download option is active.

And that's it... to make it a bit more automated, create a script like so:

Put the following into a file (ie dlfiles) adjusting it where necessary:

#!/bin/bash
wget -c --load-cookies .cookies/megaupload http://www.megaupload.com/s.....

save it and make it executable:

chmod -x dlfiles

And then execute it with ./dlfiles

You can also save all the links to the files you wanted downloaded and use the input option with wget like this replacing LINKLIST with the file containing the URI's to the files you wish to download:


To do up the linklist:
(a) Create text file using vi
$ vi /tmp/download.txt

Add list of urls:
http://www.cyberciti.biz/download/lsst.tar.gz
ftp://ftp.freebsd.org/pub/sys.tar.gz
ftp://ftp.redhat.com/pub/xyz-1rc-i386.rpm
http://xyz.com/abc.iso

(b)Run wget as follows:
$wget -nc -c --load-cookies .cookies/megaupload -i /tmp/download.txt