Page 1 of 1

How to upload to megaupload using a script

Posted: Sat Jan 09, 2010 2:55 pm
by Saman
An upload script to use with megaupload for Linux users.

/usr/bin/megaupload

Code: Select all

#!/bin/bash

# place your megaupload cookie string here
# to obtain one, all you need to do is login to megaupload
# type the following in address bar
# javascript:document.write(document.cookie);
# your string is user=(something);
cstr=ABC123
description=test

for file in "$@"
do
 echo -n "Uploading...$file..."
 ident=`wget -qO- --no-cookies --header "Cookie: user=$cstr" http://www.megaupload.com/ | grep ENCTYPE | cut -d '"' -f 8`
 value=`echo $ident | cut -d '=' -f 2`
 data=`curl -s -b "user=$cstr" -F "UPLOAD_IDENTIFIER=$ident" -F "sessionid=$value" -F "file=@$file" -F "message=$description" -F "accept=on" $ident`
 size=`echo $data | cut -d ' ' -f 10``echo $data | cut -d ' ' -f 11`
 mega=`echo $data | cut -d "'" -f 6 | cut -d '=' -f 2`
 echo "$file||$size||$mega" >> links
 echo "Done!"
done
make sure the script is executable
# chmod +x /usr/bin/megaupload

examples:
# megaupload file[1-9].avi -> will upload file1.avi,file2.avi...file9.avi
# megaupload file1.avi -> will upload file1.avi
# megaupload * -> will upload all files

A log will be written to a file called links.

Re: How to upload to megaupload using a script

Posted: Tue Jun 01, 2010 7:14 pm
by snock
Very good script, thanks. :D

Re: How to upload to megaupload using a script

Posted: Sat Nov 19, 2011 1:54 am
by Alambratore
Hello and sorry for my basic English :S
Your script is very interesting but I get the following error message.

Uploading...CrmnlMnds.avi...curl: no URL specified!
curl: try 'curl --help' for more information
Done!

You help me?
Thank you very much, greetings from Argentina.

Re: How to upload to megaupload using a script

Posted: Sat Nov 19, 2011 5:43 am
by Saman
Verify whether you have done following things.
  1. Login to your Megaupload account
  2. Type javascript:document.write(document.cookie); on your address bar. The string would looks like user=(something);
  3. Now set this to cstr. For example, if it returns as user=1234, then you need to set cstr=1234 in the code.
  4. You'll have to make the script is executable using # chmod +x /usr/bin/megaupload
  5. After all the above steps, you need to call it as megaupload file1.avi
  6. That's it!