diff options
Diffstat (limited to 'module/plugins/hoster/FreakshareCom.py')
-rw-r--r-- | module/plugins/hoster/FreakshareCom.py | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index ff1056c9f..2238f07ef 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -3,23 +3,30 @@ import re from module.plugins.Hoster import Hoster -from module.plugins.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import secondsToMidnight class FreakshareCom(Hoster): - __name__ = "FreakshareCom" - __type__ = "hoster" + __name__ = "FreakshareCom" + __type__ = "hoster" + __version__ = "0.40" + __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' - __version__ = "0.39" + __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") + __license__ = "GPLv3" + __authors__ = [("sitacuisses", "sitacuisses@yahoo.de"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("Toilal", "toilal.dev@gmail.com")] + def setup(self): self.multiDL = False self.req_opts = [] + def process(self, pyfile): self.pyfile = pyfile @@ -43,24 +50,23 @@ class FreakshareCom(Hoster): "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": - self.fail("Bad Try.") + self.fail(_("Bad Try")) elif check == "paralell": self.setWait(300, True) self.wait() self.retry() elif check == "empty": - self.fail("File not downloadable") + self.fail(_("File not downloadable")) elif check == "wrong_captcha": self.invalidCaptcha() self.retry() elif check == "downloadserver": - self.retry(5, 15 * 60, "No Download server") + 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(): @@ -75,10 +81,12 @@ class FreakshareCom(Hoster): 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 """ @@ -91,6 +99,7 @@ class FreakshareCom(Hoster): else: self.offline() + def get_file_name(self): if not self.html: self.download_html() @@ -104,6 +113,7 @@ class FreakshareCom(Hoster): else: return self.pyfile.url + def get_file_size(self): size = 0 if not self.html: @@ -118,6 +128,7 @@ class FreakshareCom(Hoster): return size + def get_waiting_time(self): if not self.html: self.download_html() @@ -126,12 +137,13 @@ class FreakshareCom(Hoster): self.wantReconnect = True return secondsToMidnight(gmt=2) - timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html) + timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) if timestring: - return int(timestring.group(1)) + 1 # add 1 sec as tenths of seconds are cut off + return int(timestring.group(1)) else: return 60 + def file_exists(self): """ returns True or False """ @@ -142,6 +154,7 @@ class FreakshareCom(Hoster): else: return True + def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.html).group(0) # get the whole request @@ -150,21 +163,14 @@ class FreakshareCom(Hoster): herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page - # comment this in, when it doesnt work - # with open("DUMP__FS_.HTML", "w") as fp: - # fp.write(herewego) - to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) - # comment this in, when it doesnt work as well - #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort]) - - challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego) + challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) if challenge: re_captcha = ReCaptcha(self) - (request_options['recaptcha_challenge_field'], + (request_options['recaptcha_challenge_field'], request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) return request_options |