1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

Megaupload shell uploader

Discussion in 'Programming' started by Kaizoku, Jan 7, 2010.

  1. #1
    Just wanted to share, for those linux users having trouble uploading to megaupload.

    /usr/bin/megaupload
    
    #!/bin/bash
    
    # place your megaupload cookie string here
    # to obtain one, all you need to do is login to megaupload (doesn't work for safari)
    # 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" [url]http://www.megaupload.com/multiupload/[/url] | 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`
     echo "$mega|$size|$file" >> links
     echo "Done!"
    done
    
    Code (markup):
    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.
     
    Last edited: Dec 10, 2011
    Kaizoku, Jan 7, 2010 IP
    shearerc likes this.
  2. bitist

    bitist Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Thanks for sharing this script.

    Do you have a similar script for downloads?
    I would like to have something like:
    # megadownload file1.avi -> to download file1.avi
     
    bitist, Jan 7, 2010 IP
  3. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #3
    In case you've got a premium, just use Curl.
     
    iAreCow, Jan 7, 2010 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    You would need premium for that, megaupload has a captcha code.
     
    Kaizoku, Jan 7, 2010 IP
  5. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #5
    There was a solution once, for bypassing captcha, /somename.php?d=link_code, I cant remember it exactly, just Google it.
     
    iAreCow, Jan 7, 2010 IP
  6. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #6
    You can also use OCR to decode the captcha.
     
    Kaizoku, Jan 8, 2010 IP
  7. danx10

    danx10 Peon

    Messages:
    1,181
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #7
    It was /mgr_dl.php?d=$uploadid but megaupload patched it.
     
    danx10, Jan 10, 2010 IP
  8. Euti

    Euti Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I recommend you to use this new tool: Tucan Manager (http://tucaneando.com/). This application has a command line mode (CLI) to download from Megaupload, Rapidshare, Gigasize, ... without the needed of to introduce the captcha. And it accepts Premium Accounts.

    To know more about the CLI, there's a manual here (http://blog.tucaneando.com/2009/10/26/detalles-sobre-el-cli/), but it is in Spanish, so you can use the Google Translator. If you have some problems to understand it, please ask me (I speak native Spanish).
     
    Euti, Jan 20, 2010 IP
  9. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #9
    That doesn't look like a cli application.
     
    Kaizoku, Jan 21, 2010 IP
  10. bitist

    bitist Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I can confirm that software couldn't be started in CLI mode. I've tried even from command line and always the GUI appeared.
     
    bitist, Jan 21, 2010 IP
  11. Euti

    Euti Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    For this I put the second link, and if you read it (is in Spanish, translate it please), if you use the application in linux like:

    tucan -c -i filename

    you will open it in CLI mode, and downloading the files writed in input file "filename". Try it ;)
     
    Euti, Jan 21, 2010 IP
  12. hocupare

    hocupare Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    tnx for this.
     
    hocupare, Jan 24, 2010 IP
  13. Neokenzo

    Neokenzo Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Is it possible to upload and set a password on the file as well?

    Do you see the percentage when its being uploaded?

    BTW, thank you for this. Been looking for a solution to this :)
     
    Neokenzo, Jan 27, 2010 IP
  14. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #14
    Those can easily be implemented, I took out status bar to reduce server load, because this script is meant to be run in background.
     
    Kaizoku, Jan 28, 2010 IP
  15. tech_savvy

    tech_savvy Peon

    Messages:
    436
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    very tight and nice script that one. thanks for sharing. would be trying it out.
     
    tech_savvy, Jan 30, 2010 IP
  16. Neokenzo

    Neokenzo Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I am getting this error when I tried the script "-bash: syntax error near unexpected token `('"
     
    Neokenzo, Feb 4, 2010 IP
  17. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #17
    Probably the file has a parenthesis, you would need to escape it.
     
    Kaizoku, Feb 4, 2010 IP
  18. Ortix

    Ortix Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    OMG I was looking for this and i finally found it! This is great!

    But there is 1 thing i am specifically looking for this script to do:

    Can it like "watch" a folder (perhaps the folder it is in, or a subfolder of that) and everytime a new file is added, it automatically uploads it to megaupload?

    I am running this download->upload thing and i would LOVE to see that functionality!

    Is it possible for the script to delete the file 2 hours after upload? (not really necessary)
     
    Ortix, Mar 21, 2010 IP
  19. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #19
    This can be done by running a daemon, I wrote this program for simple upload only. If you want something fancy, pm me if you are willing to pay.
     
    Kaizoku, Mar 23, 2010 IP
  20. jijieyz

    jijieyz Guest

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Thanks for sharing..
     
    jijieyz, Mar 26, 2010 IP