diff options
author | mkaay <mkaay@mkaay.de> | 2009-11-09 13:38:32 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2009-11-09 13:38:32 +0100 |
commit | cd500e34c6af6ce6ae8ed4b0086a7955c45a57eb (patch) | |
tree | 987698f7b2265abbc9241d51e6e5d386609003f6 | |
parent | Added tag v0.2.2 for changeset 0f85b895018a (diff) | |
download | pyload-cd500e34c6af6ce6ae8ed4b0086a7955c45a57eb.tar.xz |
uploaded.to premium
-rwxr-xr-x | module/network/Request.py | 14 | ||||
-rw-r--r-- | module/plugins/UploadedTo.py | 47 | ||||
-rw-r--r-- | pluginconfig | 5 |
3 files changed, 54 insertions, 12 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 742111a2a..092e75a01 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -93,9 +93,6 @@ class Request: self.pycurl.setopt(pycurl.CONNECTTIMEOUT, 30) self.pycurl.setopt(pycurl.NOSIGNAL, 1) self.pycurl.setopt(pycurl.NOPROGRESS, 0) - cookie_file = "module" + sep + "cookies.txt" - self.pycurl.setopt(pycurl.COOKIEFILE, cookie_file) - self.pycurl.setopt(pycurl.COOKIEJAR, cookie_file) self.pycurl.setopt(pycurl.PROGRESSFUNCTION, self.progress) self.pycurl.setopt(pycurl.AUTOREFERER, 1) self.pycurl.setopt(pycurl.HEADERFUNCTION, self.write_header) @@ -127,6 +124,9 @@ class Request: self.pycurl.setopt(pycurl.URL, url) self.pycurl.setopt(pycurl.WRITEFUNCTION, self.rep.write) + + if cookies: + self.curl_enable_cookies() if post: self.pycurl.setopt(pycurl.POSTFIELDS, post) @@ -167,6 +167,11 @@ class Request: return output + def curl_enable_cookies(self): + cookie_file = "module" + sep + "cookies.txt" + self.pycurl.setopt(pycurl.COOKIEFILE, cookie_file) + self.pycurl.setopt(pycurl.COOKIEJAR, cookie_file) + def add_auth(self, user, pw): self.auth = True @@ -228,6 +233,9 @@ class Request: self.pycurl.setopt(pycurl.URL, url) self.pycurl.setopt(pycurl.WRITEDATA, fp) + + if cookies: + self.curl_enable_cookies() if post: self.pycurl.setopt(pycurl.POSTFIELDS, post) diff --git a/module/plugins/UploadedTo.py b/module/plugins/UploadedTo.py index e65be789c..50ea01459 100644 --- a/module/plugins/UploadedTo.py +++ b/module/plugins/UploadedTo.py @@ -13,26 +13,35 @@ class UploadedTo(Plugin): props['name'] = "UploadedTo" props['type'] = "hoster" props['pattern'] = r"http://(?:www\.)?u(?:p)?l(?:oaded)?\.to/" - props['version'] = "0.1" + props['version'] = "0.2" props['description'] = """Uploaded.to Download Plugin""" - props['author_name'] = ("spoob") - props['author_mail'] = ("spoob@pyload.org") + props['author_name'] = ("spoob", "mkaay") + props['author_mail'] = ("spoob@pyload.org", "mkaay@mkaay.de") self.props = props self.parent = parent self.html = None self.html_old = None #time() where loaded the HTML self.time_plus_wait = None #time() + wait in seconds - self.want_reconnect = None - self.multi_dl = False + + self.want_reconnect = False + + self.read_config() + if self.config['premium']: + self.multi_dl = True + else: + self.multi_dl = False + + self.start_dl = False def prepare(self, thread): pyfile = self.parent - + self.want_reconnect = False tries = 0 while not pyfile.status.url: - + + self.req.clear_cookies() self.download_html() pyfile.status.exists = self.file_exists() @@ -41,6 +50,12 @@ class UploadedTo(Plugin): raise Exception, "The file was not found on the server." pyfile.status.filename = self.get_file_name() + + if self.config['premium']: + pyfile.status.url = self.parent.url + return True + + self.get_waiting_time() pyfile.status.waituntil = self.time_plus_wait pyfile.status.url = self.get_file_url() @@ -55,11 +70,15 @@ class UploadedTo(Plugin): raise Exception, "Error while preparing DL, HTML dump: %s" % self.html return True - + def download_html(self): + if self.config['premium']: + self.config['username'], self.config['password'] + self.req.load("http://uploaded.to/login", None, { "email" : self.config['username'], "password" : self.config['password']}) url = self.parent.url - self.html = self.req.load(url) + self.html = self.req.load(url, cookies=False) + def get_waiting_time(self): try: wait_minutes = re.search(r"Or wait ([\d\-]+) minutes", self.html).group(1) if int(wait_minutes) < 0: wait_minutes = 1 @@ -71,6 +90,10 @@ class UploadedTo(Plugin): def get_file_url(self): """ returns the absolute downloadable filepath """ + if self.config['premium']: + self.start_dl = True + return self.parent.url + try: file_url_pattern = r".*<form name=\"download_form\" method=\"post\" action=\"(.*)\">" return re.search(file_url_pattern, self.html).group(1) @@ -95,3 +118,9 @@ class UploadedTo(Plugin): return False else: return True + + def proceed(self, url, location): + if self.config['premium']: + self.req.download(url, location, cookies=True) + else: + self.req.download(url, location, cookies=False, post={"download_submit": "Free Download"}) diff --git a/pluginconfig b/pluginconfig index 856a1fddc..97e33899e 100644 --- a/pluginconfig +++ b/pluginconfig @@ -10,6 +10,11 @@ premium = False username = namehere password = passhere +[UploadedTo] +premium = False +username = namehere +password = passhere + [YoutubeCom] high_quality = True |