summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/UploadingCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/UploadingCom.py')
-rw-r--r--pyload/plugins/hoster/UploadingCom.py52
1 files changed, 27 insertions, 25 deletions
diff --git a/pyload/plugins/hoster/UploadingCom.py b/pyload/plugins/hoster/UploadingCom.py
index 9938d4829..ffb275d94 100644
--- a/pyload/plugins/hoster/UploadingCom.py
+++ b/pyload/plugins/hoster/UploadingCom.py
@@ -9,20 +9,21 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t
class UploadingCom(SimpleHoster):
- __name__ = "UploadingCom"
- __type__ = "hoster"
- __version__ = "0.36"
+ __name__ = "UploadingCom"
+ __type__ = "hoster"
+ __version__ = "0.38"
- __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)'
+ __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)'
__description__ = """Uploading.com hoster plugin"""
- __authors__ = [("jeix", "jeix@hasnomail.de"),
- ("mkaay", "mkaay@mkaay.de"),
- ("zoidberg", "zoidberg@mujmail.cz")]
+ __license__ = "GPLv3"
+ __authors__ = [("jeix", "jeix@hasnomail.de"),
+ ("mkaay", "mkaay@mkaay.de"),
+ ("zoidberg", "zoidberg@mujmail.cz")]
- FILE_NAME_PATTERN = r'id="file_title">(?P<N>.+)</'
- FILE_SIZE_PATTERN = r'size tip_container">(?P<S>[\d.]+) (?P<U>\w+)<'
+ NAME_PATTERN = r'id="file_title">(?P<N>.+)</'
+ SIZE_PATTERN = r'size tip_container">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<'
OFFLINE_PATTERN = r'(Page|file) not found'
COOKIES = [(".uploading.com", "lang", "1"),
@@ -36,7 +37,7 @@ class UploadingCom(SimpleHoster):
pyfile.url = pyfile.url.replace("/files", "/files/get")
self.html = self.load(pyfile.url, decode=True)
- self.file_info = self.getFileInfo()
+ self.getFileInfo()
if self.premium:
self.handlePremium()
@@ -46,7 +47,7 @@ class UploadingCom(SimpleHoster):
def handlePremium(self):
postData = {'action': 'get_link',
- 'code': self.file_info['ID'],
+ 'code': self.info['ID'],
'pass': 'undefined'}
self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
@@ -55,7 +56,7 @@ class UploadingCom(SimpleHoster):
url = url.group(1).replace("\\/", "/")
self.download(url)
- raise Exception("Plugin defect.")
+ raise Exception("Plugin defect")
def handleFree(self):
@@ -63,39 +64,40 @@ class UploadingCom(SimpleHoster):
if m:
self.pyfile.error = m.group(1)
self.logWarning(self.pyfile.error)
- self.retry(max_tries=6, wait_time=6 * 60 * 60 if m.group(2) else 15 * 60, reason=self.pyfile.error)
+ self.retry(6, (6 * 60 if m.group(2) else 15) * 60, self.pyfile.error)
ajax_url = "http://uploading.com/files/get/?ajax"
self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = self.pyfile.url
- response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.file_info['ID']}))
- if 'answer' in response and 'wait_time' in response['answer']:
- wait_time = int(response['answer']['wait_time'])
- self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']}))
+
+ if 'answer' in res and 'wait_time' in res['answer']:
+ wait_time = int(res['answer']['wait_time'])
+ self.logInfo(_("Waiting %d seconds") % wait_time)
self.wait(wait_time)
else:
- self.parseError("AJAX/WAIT")
+ self.error(_("No AJAX/WAIT"))
+
+ res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'}))
- response = json_loads(
- self.load(ajax_url, post={'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'}))
- if 'answer' in response and 'link' in response['answer']:
- url = response['answer']['link']
+ if 'answer' in res and 'link' in res['answer']:
+ url = res['answer']['link']
else:
- self.parseError("AJAX/URL")
+ self.error(_("No AJAX/URL"))
self.html = self.load(url)
m = re.search(r'<form id="file_form" action="(.*?)"', self.html)
if m:
url = m.group(1)
else:
- self.parseError("URL")
+ self.error(_("No URL"))
self.download(url)
check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")})
if check == "html":
- self.logWarning("Redirected to a HTML page, wait 10 minutes and retry")
+ self.logWarning(_("Redirected to a HTML page, wait 10 minutes and retry"))
self.wait(10 * 60, True)