diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-10-23 02:29:11 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-10-23 02:29:11 +0200 |
commit | 047bc9aff002206137b520912170377453668448 (patch) | |
tree | bffa56be3927b82735d933ffee55981896be39c3 /module/plugins | |
parent | closed #404 (diff) | |
download | pyload-047bc9aff002206137b520912170377453668448.tar.xz |
fix DepositfilesCom (#407)
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 4f2cc9fc4..1fba3bad5 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -4,37 +4,61 @@ import re import urllib from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + +def getInfo(urls): + result = [] + + for url in urls: + html = getURL(re.sub(r"\.com(/.*?)?/files", ".com/en/files", url), decode=True) + if re.search(DepositfilesCom.FILE_OFFLINE_PATTERN, html): + # File offline + result.append((url, 0, 1, url)) + else: + # Get file info + name, size = url, 0 + + found = re.search(DepositfilesCom.FILE_INFO_PATTERN, html) + if found is not None: + name, size, units = found.groups() + size = float(size) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[units] + result.append((name, size, 2, url)) + yield result class DepositfilesCom(Hoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" - __version__ = "0.32" + __version__ = "0.33" __description__ = """Depositfiles.com Download Hoster""" - __author_name__ = ("spoob") - __author_mail__ = ("spoob@pyload.org") + __author_name__ = ("spoob", "zoidberg") + __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = r'File name: <b title="([^"]+)">.*\s*<span class="nowrap">File size: <b>([0-9.]+) (KB|MB|GB)</b>' + FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' def setup(self): self.resumeDownload = self.multiDL = True if self.account else False - self.pyfile.url = re.sub(r"\.com(/.*?)?/files", ".com/de/files", self.pyfile.url) - + 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) - - if '<span class="html_download_api-not_exists"></span>' in self.html: + self.html = self.load(self.pyfile.url, cookies=True if self.account else False, decode = True) + + if self.FILE_OFFLINE_PATTERN in self.html: self.offline() - - - - return_url = self.req.lastEffectiveURL.split("/", 3)[3] - self.html = self.load(r'http://depositfiles.com/switch_lang.php?return_url=%s&lang=de' % return_url) - pyfile.name = re.search('(?s)Dateiname: <b title=\"(.*?)\">.*?</b>', self.html).group(1) + pyfile.name, size, units = re.search(self.FILE_INFO_PATTERN, self.html).groups() + pyfile.size = float(size) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[units] + self.logDebug ("FILENAME: %s" % pyfile.name) + #return_url = self.req.lastEffectiveURL.split("/", 3)[3] + #self.html = self.load(r'http://depositfiles.com/switch_lang.php?return_url=%s&lang=en' % return_url) + + #pyfile.name = re.search('(?s)Dateiname: <b title=\"(.*?)\">.*?</b>', self.html).group(1) if self.account: self.handlePremium() @@ -50,7 +74,7 @@ class DepositfilesCom(Hoster): self.setWait(61) self.wait() self.retry() - + wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) if wait: wait_time = int(wait.group(1)) @@ -70,20 +94,29 @@ class DepositfilesCom(Hoster): if wait: self.setWait(int(wait.group(1))) + found = re.search(r"var fid = '(\w+)';", self.html) + if not found: self.retry(wait_time=5) + fid = found.group(1) + self.logDebug ("FID: %s" % fid) + self.wait() - form = re.search(r"\$\('#download_container'\)\.load\('([^']+)", self.html) + #form = re.search(r"\$\('#download_container'\)\.load\('([^']+)", self.html) - self.html = self.load("http://depositfiles.com/"+ form.group(1)) + #self.html = self.load("http://depositfiles.com/"+ form.group(1)) + self.html = self.load("http://depositfiles.com/get_file.php?fid=" + fid) link = urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1)) - self.download(link) + self.logDebug ("LINK: %s" % link) + try: + self.download(link) + except: + self.retry(wait_time = 60) - #wait_time = int(re.search(r'<span id="download_waiter_remain">(.*?)</span>', self.html).group(1)) #self.setWait(wait_time) #self.log.debug("DepositFiles.com: Waiting %d seconds." % wait_time) def handlePremium(self): link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) - self.download(link) + self.download(link)
\ No newline at end of file |