# -*- coding: utf-8 -*- import re from module.plugins.Hoster import Hoster from module.plugins.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __version__ = "0.39" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' __description__ = """Freakshare.com hoster plugin""" __author_name__ = ("sitacuisses", "spoob", "mkaay", "Toilal") __author_mail__ = ("sitacuisses@yahoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "toilal.dev@gmail.com") def setup(self): self.multiDL = False self.req_opts = [] def process(self, pyfile): self.pyfile = pyfile pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/") if self.account: self.html = self.load(pyfile.url, cookies=False) pyfile.name = self.get_file_name() self.download(pyfile.url) else: self.prepare() self.get_file_url() self.download(pyfile.url, post=self.req_opts) check = self.checkDownload({"bad": "bad try", "paralell": "> Sorry, you cant download more then 1 files at time. <", "empty": "Warning: Unknown: Filename cannot be empty", "wrong_captcha": "Wrong Captcha!", "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": self.fail("Bad Try.") elif check == "paralell": self.setWait(300, True) self.wait() self.retry() elif check == "empty": self.fail("File not downloadable") elif check == "wrong_captcha": self.invalidCaptcha() self.retry() elif check == "downloadserver": self.retry(5, 15 * 60, "No Download server") def prepare(self): pyfile = self.pyfile self.wantReconnect = False self.download_html() if not self.file_exists(): self.offline() self.setWait(self.get_waiting_time()) pyfile.name = self.get_file_name() pyfile.size = self.get_file_size() self.wait() return True def download_html(self): self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session self.html = self.load(self.pyfile.url) def get_file_url(self): """ returns the absolute downloadable filepath """ if not self.html: self.download_html() if not self.wantReconnect: self.req_opts = self.get_download_options() # get the Post options for the Request #file_url = self.pyfile.url #return file_url else: self.offline() def get_file_name(self): if not self.html: self.download_html() if not self.wantReconnect: file_name = re.search(r"