diff options
Diffstat (limited to 'module/plugins/hoster/UploadingCom.py')
-rw-r--r-- | module/plugins/hoster/UploadingCom.py | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 1278bfc01..4a157a787 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -18,20 +18,22 @@ """
import re
+from pycurl import HTTPHEADER
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.common.json_layer import json_loads
class UploadingCom(SimpleHoster):
__name__ = "UploadingCom"
__type__ = "hoster"
- __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?[\w\d]+/?"
- __version__ = "0.30"
+ __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)"
+ __version__ = "0.32"
__description__ = """Uploading.Com File Download Hoster"""
__author_name__ = ("jeix", "mkaay", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
FILE_NAME_PATTERN = r'<title>Download (?P<N>.*?) for free on uploading.com</title>'
FILE_SIZE_PATTERN = r'<span>File size: (?P<S>.*?)</span>'
- FILE_OFFLINE_PATTERN = r'<h2 style=".*?">The requested file is not found</h2>'
+ FILE_OFFLINE_PATTERN = r'<h2.*?>The requested file is not found</h2>'
def process(self, pyfile):
# set lang to english
@@ -47,21 +49,20 @@ class UploadingCom(SimpleHoster): self.file_info = self.getFileInfo()
if self.premium:
- url = self.handlePremium()
+ self.handlePremium()
else:
- url = self.handleFree()
-
- self.download(url)
+ self.handleFree()
def handlePremium(self):
postData = {'action': 'get_link',
- 'code': re.search('code: "(.*?)",', self.html).group(1),
+ 'code': self.file_info['ID'],
'pass': 'undefined'}
self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
if url:
- return url.group(1).replace("\\/", "/")
+ url = url.group(1).replace("\\/", "/")
+ self.download(url)
raise Exception("Plugin defect.")
@@ -72,39 +73,38 @@ class UploadingCom(SimpleHoster): self.logWarning(self.pyfile.error)
self.retry(max_tries=6, wait_time = 21600 if found.group(2) else 900, reason = self.pyfile.error)
- self.code = re.search(r'name="code" value="(.*?)"', self.html).group(1)
- self.fileid = re.search(r'name="file_id" value="(.*?)"', self.html).group(1)
-
- postData = {'action': 'second_page',
- 'code': self.code,
- 'file_id': self.fileid}
-
- self.html = self.load(self.pyfile.url, post=postData)
+ 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
- wait_time = re.search(r'timead_counter">(\d+)<', self.html)
- if not wait_time:
- wait_time = re.search(r'start_timer\((\d+)\)', self.html)
-
- if wait_time:
- wait_time = int(wait_time.group(1))
+ 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.log.info("%s: Waiting %d seconds." % (self.__name__, wait_time))
self.setWait(wait_time)
self.wait()
+ else:
+ self.pluginParseError("AJAX/WAIT")
+ 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']
+ else:
+ self.pluginParseError("AJAX/URL")
+
+ self.html = self.load(url)
+ found = re.search(r'<form id="file_form" action="(.*?)"', self.html)
+ if found:
+ url = found.group(1)
+ else:
+ self.pluginParseError("URL")
- postData = {'action': 'get_link',
- 'code': self.code,
- 'pass': 'undefined'}
-
- if r'var captcha_src' in self.html[1]:
- captcha_url = "http://uploading.com/general/captcha/download%s/?ts=%d" % (self.fileid, timestamp())
- postData['captcha_code'] = self.decryptCaptcha(captcha_url)
-
- self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
- url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
- if url:
- return url.group(1).replace("\\/", "/")
-
- raise Exception("Plugin defect.")
+ 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.setWait(600, True)
+ self.wait()
getInfo = create_getInfo(UploadingCom)
\ No newline at end of file |