summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmodule/network/Request.py4
-rw-r--r--module/plugins/Plugin.py4
-rw-r--r--module/plugins/hoster/MegauploadCom.py5
-rw-r--r--module/plugins/hoster/UploadingCom.py80
4 files changed, 88 insertions, 5 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index b393012a9..b281714a3 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -125,7 +125,7 @@ class Request:
return self.cookieJar.getCookie(name)
return None
- def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False):
+ def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False, raw_cookies={}):
self.pycurl.setopt(pycurl.NOPROGRESS, 1)
@@ -149,6 +149,8 @@ class Request:
if cookies:
self.curl_enable_cookies()
self.getCookies()
+ if raw_cookies:
+ self.pycurl.setopt(pycurl.COOKIELIST, "Set-Cookie: %s;"% "; ".join(["%s=%s"%(x,y) for x,y in raw_cookies.items()]))
if post:
self.pycurl.setopt(pycurl.POSTFIELDS, post)
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index d642df728..34c06539a 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -278,11 +278,11 @@ class Plugin(object):
return result
- def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False):
+ def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False, raw_cookies={}):
""" returns the content loaded """
if self.pyfile.abort: raise Abort
- res = self.req.load(url, get, post, ref, cookies, just_header)
+ res = self.req.load(url, get, post, ref, cookies, just_header, no_post_encode, raw_cookies)
if self.core.debug:
from inspect import currentframe
frame = currentframe()
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index 45711191e..92daedec2 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -101,8 +101,9 @@ class MegauploadCom(Hoster):
self.download(pyfile.url)
def download_html(self):
- for i in range(5):
+ for i in range(3):
self.html[0] = self.load(self.pyfile.url)
+ self.html[1] = self.html[0] # in case of no captcha, this already contains waiting time, etc
count = 0
if "The file that you're trying to download is larger than 1 GB" in self.html[0]:
self.fail(_("You need premium to download files larger than 1 GB"))
@@ -165,7 +166,7 @@ class MegauploadCom(Hoster):
def get_file_url(self):
- file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="'
+ file_url_pattern = 'id="downloadlink"><a href="(.*)"\s+(?:onclick|class)="'
search = re.search(file_url_pattern, self.html[1])
return search.group(1).replace(" ", "%20")
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
new file mode 100644
index 000000000..4e3e8a06c
--- /dev/null
+++ b/module/plugins/hoster/UploadingCom.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from time import time
+
+from module.plugins.Hoster import Hoster
+
+
+class UploadingCom(Hoster):
+ __name__ = "UploadingCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?[\w\d]+/?"
+ __version__ = "0.1"
+ __description__ = """Uploading.Com File Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def setup(self):
+ self.html = [None,None,None]
+ if self.account:
+ self.req.canContinue = True
+ else:
+ self.multiDL = False
+
+ def process(self, pyfile):
+ # set lang to english
+ self.html[0] = self.load(self.pyfile.url, raw_cookies={"lang":"1"})
+ if re.search(r'<h2 style=".*?">The requested file is not found</h2>', self.html[0]) is not None:
+ self.offline()
+
+ self.pyfile.name = re.search(r'<title>Download (.*?) for free on uploading.com</title>', self.html[0]).group(1)
+
+ if self.account:
+ url = self.handlePremium()
+ else:
+ url = self.handleFree()
+
+ self.download(url)
+
+ def handlePremium(self):
+ pass
+
+ def handleFree(self):
+ self.code = re.search(r'name="code" value="(.*?)"', self.html[0]).group(1)
+ self.fileid = re.search(r'name="file_id" value="(.*?)"', self.html[0]).group(1)
+
+ postData = {}
+ postData['action'] = 'second_page'
+ postData['code'] = self.code
+ postData['file_id'] = self.fileid
+
+ self.html[1] = self.load(self.pyfile.url, post=postData)
+
+ wait_time = re.search(r'timead_counter">(\d+)<', self.html[1])
+ if not wait_time:
+ wait_time = re.search(r'start_timer\((\d+)\)', self.html[1])
+
+ if wait_time:
+ wait_time = int(wait_time.group(1))
+ self.log.info("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.setWait(wait_time)
+ self.wait()
+
+
+ postData = {}
+ postData['action'] = 'get_link'
+ postData['code'] = self.code
+ postData['pass'] = 'undefined'
+
+ if r'var captcha_src' in self.html[1]:
+ captcha_url = "http://uploading.com/general/captcha/download%s/?ts=%d" % (self.fileid, time()*1000)
+ postData['captcha_code'] = self.decryptCaptcha(captcha_url)
+
+ self.html[2] = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % (time()*1000), post=postData)
+ url = re.search(r'"link"\s*:\s*"(.*?)"', self.html[2])
+ if url:
+ return url.group(1).replace("\\/", "/")
+
+ raise Exception("Plugin defect.")