lollercoaster lollercoaster - 1 year ago 136
Python Question

how to download an entire folder of public files from megaupload (

I'm trying to download a public link (no login required). See the below:

enter image description here

Essentially in the browser you can select download as zip from the menu, but I don't have enough storage space on my laptop, so I'd like to do it on AWS.

The links are in the format:!XXXXXXXX!XXXXXXXXXXXXXXXXXX-XXX

Things I've tried that don't work:

If anyone has a working command line script or knows how I might build something of the form for the command line


that would be awesome.

If there is a way in the browser (tried but couldn't find) to just find a static link by which I could then paste into a simple
script in Python, that would even be the best, but I couldn't find such a link in the source of the page.

Answer Source

You are not using a simple file server, but a web application that offers to download files as ZIP. If it is zipping "on fly" server side, the static link you want may not exist at all.

When facing such a problem, the only foolproof way is (it is a python based way as you question is tagged as python) :

  • write a python script on your laptop that simulates what you do in browser and test it on laptop. If using Python 2.x, you could use mechanize, or simply the Standard Python Library modules urllib2 (python 2.x) or urlib.request (python 3.x). Be sure to add a CookieProcessor to the list of standard handlers to correctly process sessions.
  • analyse in browser (or try to use wireshark to see it directly in HTTP frames) the commands that are sent to server and control that you can send them from your script and get expected responses
  • once your script runs fine on the laptop, port it and use it where you need.

Ok it is not a very precise answer, but it should give you enough hints and the path to go. Feel then free to ask more detailed questions here if you get stuck anywhere in the procedure : just give the python code you have written and explain what you do not know how to do. You should get more precise answers.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download