# -*- coding: utf-8 -*- from __future__ import with_statement import re from os import remove from module.plugins.Hoster import Hoster from module.plugins.ReCaptcha import ReCaptcha from module.network.RequestFactory import getURL def getInfo(urls): result = [] for url in urls: # Get html html = getURL(url) if re.search(r'

File not available

', html): result.append((url, 0, 1, url)) continue # Name name = re.search('

(.*?)

', html).group(1) # Size m = re.search(r"(.*?) (KB|MB|GB)", html) units = float(m.group(1)) pow = {'KB' : 1, 'MB' : 2, 'GB' : 3}[m.group(2)] size = int(units*1024**pow) # Return info result.append((name, size, 2, url)) yield result class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?fileserve\.com/file/[a-zA-Z0-9]+" __version__ = "0.3" __description__ = """Fileserve.Com File Download Hoster""" __author_name__ = ("jeix", "mkaay") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de") def setup(self): if self.account: self.premium = self.account.getAccountInfo(self.user)["premium"] if not self.premium: self.multiDL = False self.resumeDownload = False self.chunkLimit = 1 else: self.multiDL = False self.file_id = re.search(r"fileserve\.com/file/([a-zA-Z0-9]+)(http:.*)?", self.pyfile.url).group(1) def process(self, pyfile): self.html = self.load(self.pyfile.url, ref=False, cookies=False if self.account else True, utf8=True) if re.search(r'

File not available

', self.html) is not None: self.offline() if 'Your download link has expired' in self.html: with open("fsdump.html", "w") as fp: fp.write(self.html) self.offline()#retry() self.pyfile.name = re.search('

(.*?)

', self.html).group(1) if self.account and self.premium: self.handlePremium() else: self.handleFree() def handlePremium(self): self.download(self.pyfile.url, post={"download":"premium"}, cookies=True) def handleFree(self): self.html = self.load(self.pyfile.url) jsPage = re.search(r"\"(/landing/.*?/download_captcha\.js)\"", self.html) self.req.putHeader("X-Requested-With", "XMLHttpRequest") jsPage = self.load("http://fileserve.com" + jsPage.group(1)) action = self.load(self.pyfile.url, post={"checkDownload" : "check"}) if "timeLimit" in action: html = self.load(self.pyfile.url, post={"checkDownload" : "showError", "errorType" : "timeLimit"}) wait = re.search(r"You need to wait (\d+) seconds to start another download", html) if wait: wait = int(wait.group(1)) else: wait = 720 self.setWait(wait, True) self.wait() self.retry() if r'