summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/DepositfilesCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-20 03:29:17 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-20 03:29:17 +0200
commitf87a5ccc7f120946ce0973999029eaf6e39cd5a2 (patch)
tree27877ad04c1d9aed054d364ffded7aa6d5f54ed6 /module/plugins/hoster/DepositfilesCom.py
parentFix hosters SH_COOKIES syntax (diff)
downloadpyload-f87a5ccc7f120946ce0973999029eaf6e39cd5a2.tar.xz
[DepositfilesCom] Fixed premium dl
Diffstat (limited to 'module/plugins/hoster/DepositfilesCom.py')
-rw-r--r--module/plugins/hoster/DepositfilesCom.py44
1 files changed, 30 insertions, 14 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 0192859b7..386e3694e 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -1,30 +1,38 @@
# -*- coding: utf-8 -*-
import re
-from urllib import unquote
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class DepositfilesCom(SimpleHoster):
__name__ = "DepositfilesCom"
+ __version__ = "0.47"
__type__ = "hoster"
- __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/[\w]+'
- __version__ = "0.46"
+
+ __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)'
+
__description__ = """Depositfiles.com hoster plugin"""
- __author_name__ = ("spoob", "zoidberg")
- __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
+ __author_name__ = ("spoob", "zoidberg", "Walter Purcaro")
+ __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "vuolter@gmail.com")
FILE_NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
- 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>")]
+ FILE_URL_REPLACEMENTS = [(__pattern__, "https://dfiles.eu/files/\g<ID>")]
+
+ SH_COOKIES = [(".dfiles.eu", "lang_current", "en")]
RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
- LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
+
+ FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
+ PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"'
+ PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"'
+
def handleFree(self):
self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
@@ -67,7 +75,7 @@ class DepositfilesCom(SimpleHoster):
recaptcha = ReCaptcha(self)
for _ in xrange(5):
- self.html = self.load("http://depositfiles.com/get_file.php", get=params)
+ self.html = self.load("https://dfiles.eu/get_file.php", get=params)
if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
if not captcha_key:
@@ -78,7 +86,7 @@ class DepositfilesCom(SimpleHoster):
self.logDebug(params)
continue
- found = re.search(self.LINK_PATTERN, self.html)
+ found = re.search(self.FREE_LINK_PATTERN, self.html)
if found:
if 'response' in params:
self.correctCaptcha()
@@ -96,15 +104,23 @@ class DepositfilesCom(SimpleHoster):
self.retry(wait_time=60)
def handlePremium(self):
+ self.html = self.load(self.pyfile.url, cookies=self.SH_COOKIES)
+
if '<span class="html_download_api-gold_traffic_limit">' in self.html:
self.logWarning("Download limit reached")
self.retry(25, 60 * 60, "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, disposition=True)
-
+ else:
+ link = re.search(self.PREMIUM_LINK_PATTERN, self.html)
+ mirror = re.search(self.PREMIUM_MIRROR_PATTERN, self.html)
+ if link:
+ dlink = link.group(1)
+ elif mirror:
+ dlink = mirror.group(1)
+ else:
+ self.parseError("No direct download link or mirror found")
+ self.download(dlink, disposition=True)
getInfo = create_getInfo(DepositfilesCom)