summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/DepositfilesCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/DepositfilesCom.py')
-rw-r--r--module/plugins/hoster/DepositfilesCom.py62
1 files changed, 27 insertions, 35 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 87e5e7254..9c13a5f3a 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -3,52 +3,35 @@
import re
from urllib import unquote
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
from module.plugins.ReCaptcha import ReCaptcha
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(DepositfilesCom, url, getURL(re.sub(r"\.com(/.*?)?/files", ".com/en/files", url), decode=True))
- result.append(file_info)
-
- yield result
-
class DepositfilesCom(SimpleHoster):
__name__ = "DepositfilesCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+"
- __version__ = "0.36"
+ __version__ = "0.42"
__description__ = """Depositfiles.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r'File name: <b title="(?P<N>[^"]+)">.*\s*<span class="nowrap">File size: <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
+ FILE_NAME_PATTERN = r'File name: <b title="(?P<N>[^"]+)'
+ FILE_SIZE_PATTERN = r'File size: <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
+ FILE_INFO_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
- RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)', this\);"
+ FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
+ FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]
+
+ RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"'
def setup(self):
- self.resumeDownload = self.multiDL = True if self.account else False
-
- self.pyfile.url = re.sub(r"\.com(/.*?)?/files", ".com/en/files", self.pyfile.url)
-
- def process(self, pyfile):
- if re.search(r"(.*)\.html", self.pyfile.url):
- self.pyfile.url = re.search(r"(.*)\.html", self.pyfile.url).group(1)
-
- self.html = self.load(self.pyfile.url, cookies=True if self.account else False, decode = True)
- self.getFileInfo()
-
- if self.account:
- self.handlePremium()
- else:
- self.handleFree()
+ self.multiDL = False
+ self.resumeDownload = self.premium
def handleFree(self):
- self.html = self.load(self.pyfile.url, post={"gateway_result":"1"})
+ self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}, cookies = True)
if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline()
if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
@@ -81,7 +64,7 @@ class DepositfilesCom(SimpleHoster):
params = {'fid' : found.group(1)}
self.logDebug ("FID: %s" % params['fid'])
- captcha_key = None
+ captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m'
found = re.search(self.RECAPTCHA_PATTERN, self.html)
if found: captcha_key = found.group(1)
self.logDebug ("CAPTCHA_KEY: %s" % captcha_key)
@@ -91,9 +74,9 @@ class DepositfilesCom(SimpleHoster):
for i in range(5):
self.html = self.load("http://depositfiles.com/get_file.php", get = params)
-
+
if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
- if not captcha_key: raise PluginParseError('Captcha key')
+ if not captcha_key: self.parseError('Captcha key')
if 'response' in params: self.invalidCaptcha()
params['challenge'], params['response'] = recaptcha.challenge(captcha_key)
self.logDebug(params)
@@ -106,15 +89,24 @@ class DepositfilesCom(SimpleHoster):
self.logDebug ("LINK: %s" % link)
break
else:
- raise PluginParseError('Download link')
+ self.parseError('Download link')
else:
self.fail('No valid captcha response received')
try:
- self.download(link)
+ self.download(link, disposition = True)
except:
self.retry(wait_time = 60)
def handlePremium(self):
+ if '<span class="html_download_api-gold_traffic_limit">' in self.html:
+ self.logWarning("Download limit reached")
+ self.retry(25, 3600, "Download limit reached")
+ elif 'onClick="show_gold_offer' in self.html:
+ self.account.relogin(self.user)
+ self.retry()
link = unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1))
- self.download(link) \ No newline at end of file
+ self.multiDL = True
+ self.download(link, disposition = True)
+
+getInfo = create_getInfo(DepositfilesCom) \ No newline at end of file