开发者

Download from Megaupload with login - Python

开发者 https://www.devze.com 2023-04-10 10:37 出处:网络
It\'s my first question here. Today, I\'ve done a little application using wxPython: a simple Megaupload Downloade开发者_JAVA百科r, but yet, it doesn\'t support premium accounts.

It's my first question here.

Today, I've done a little application using wxPython: a simple Megaupload Downloade开发者_JAVA百科r, but yet, it doesn't support premium accounts.

Now I would like to know how to download from MU with a login (free or premium user).

I'm very new to Python, so please don't be specific and "professional". I used to download files with urlretrieve but, but is there a way to pass "arguments" or something to be able to log in as a premium user ?

Thank you. :D

EDIT =

News: new help needed xD

After trying with PyCUrl, htmllib2 and mechanize, I've done the login with urllib2 and cookiejar (the requested html says the username).

But when I start download a file, surely the server doesn't keep my login, in fact the downloaded file seems corrupted (I changed wait time from 45 to 25 seconds).

How can I download a file from MegaUpload keeping my previously done login? Thanks for your patient :D


Questions like this are usually frowned upon, they are very broad, and there are already an abundance of answers if you just search on google.

You can use urllib, or mechanize, or any library you can make an http post request with. megaupload looks to have the form values

login:1
redir:1
username:
password:

just post those values at http://megaupload.com/?c=login

all you should have to do is set your username and password to the correct values!


For logging in using Python follow the following steps.

  1. Find the list of parameters to be sent in the POST request and the url where the request has to be made by viewing the source of the login form. You may use a browser with "Inspect Element" feature to find it easily. [parameter name examples - userid, password]. Just check the tags name attribute.

  2. Most of the sites set a cookie on logging in and the cookie has to be sent along with subsequent requests. To handle this download httllib2 (http://code.google.com/p/httplib2/ ) and read the wiki page on the link given. It has shown how to login with examples.

  3. Now you can make subsequent requests for files, the cookies etc. will be handled automatically by httplib2.


i do alot of web stuff with python, i perfer using pycurl you can get it here

it is very simple to post data and login with curl, i've used it accross many languages such as PHP, python, and C++, hope this helps


You can use urllib this is a good example

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号