diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
commit | 2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch) | |
tree | 8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/FreakshareCom.py | |
parent | Fixed PEP 8 violations in Crypters (diff) | |
download | pyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz |
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/FreakshareCom.py')
-rw-r--r-- | module/plugins/hoster/FreakshareCom.py | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 156f697c3..9a9062509 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -5,14 +5,15 @@ import re from module.plugins.Hoster import Hoster from module.plugins.internal.CaptchaService import ReCaptcha + class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" __version__ = "0.37" __description__ = """Freakshare.com Download Hoster""" - __author_name__ = ("sitacuisses","spoob","mkaay", "Toilal") - __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de", "toilal.dev@gmail.com") + __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.html = None @@ -22,8 +23,8 @@ class FreakshareCom(Hoster): def process(self, pyfile): self.pyfile = pyfile - - pyfile.url = pyfile.url.replace("freakshare.net/","freakshare.com/") + + pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/") if self.account: self.html = self.load(pyfile.url, cookies=False) @@ -36,12 +37,11 @@ class FreakshareCom(Hoster): self.download(self.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!"}) - 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!"}) - if check == "bad": self.fail("Bad Try.") if check == "paralell": @@ -53,28 +53,28 @@ class FreakshareCom(Hoster): if check == "wrong_captcha": self.invalidCaptcha() self.retry() - + 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() ) + + 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.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): @@ -83,7 +83,7 @@ class FreakshareCom(Hoster): if self.html is None: self.download_html() if not self.wantReconnect: - self.req_opts = self.get_download_options() # get the Post options for the Request + self.req_opts = self.get_download_options() # get the Post options for the Request #file_url = self.pyfile.url #return file_url else: @@ -101,35 +101,35 @@ class FreakshareCom(Hoster): return file_name else: return self.pyfile.url - + def get_file_size(self): size = 0 if self.html is None: self.download_html() if not self.wantReconnect: - file_size_check = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) + file_size_check = re.search( + r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) if file_size_check is not None: units = float(file_size_check.group(1).replace(",", "")) pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)] size = int(units * 1024 ** pow) return size - + def get_waiting_time(self): if self.html is None: self.download_html() if "Your Traffic is used up for today" in self.html: self.wantReconnect = True - return 24*3600 + return 24 * 3600 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 + if timestring: + return int(timestring.group(1)) + 1 # add 1 sec as tenths of seconds are cut off else: return 60 - def file_exists(self): """ returns True or False """ @@ -141,19 +141,20 @@ class FreakshareCom(Hoster): 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 + re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", + self.html).group(0) # get the whole request to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) request_options = dict((n, v) for (v, n) in to_sort) - - herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page - + + 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) - + # 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]) |