How to upload to megaupload using a script

Linux OS Topics
Post Reply
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

How to upload to megaupload using a script

Post by Saman » Sat Jan 09, 2010 2:55 pm

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.
User avatar
snock
Posts: 1
Joined: Tue Jun 01, 2010 6:06 am

Re: How to upload to megaupload using a script

Post by snock » Tue Jun 01, 2010 7:14 pm

Very good script, thanks. :D
User avatar
Alambratore
Posts: 1
Joined: Sat Nov 19, 2011 1:45 am

Re: How to upload to megaupload using a script

Post by Alambratore » Sat Nov 19, 2011 1:54 am

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.
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: How to upload to megaupload using a script

Post by Saman » Sat Nov 19, 2011 5:43 am

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!
Post Reply

Return to “Linux”