summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FreakshareCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/FreakshareCom.py')
-rw-r--r--module/plugins/hoster/FreakshareCom.py51
1 files changed, 26 insertions, 25 deletions
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 869b8a99e..56e02cbdc 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -9,10 +9,10 @@ class FreakshareCom(Hoster):
__name__ = "FreakshareCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/"
- __version__ = "0.33"
+ __version__ = "0.37"
__description__ = """Freakshare.com Download Hoster"""
- __author_name__ = ("sitacuisses","spoob","mkaay")
- __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de")
+ __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,6 +22,7 @@ class FreakshareCom(Hoster):
def process(self, pyfile):
self.pyfile = pyfile
+
pyfile.url = pyfile.url.replace("freakshare.net/","freakshare.com/")
if self.account:
@@ -36,10 +37,22 @@ class FreakshareCom(Hoster):
self.download(self.pyfile.url, post=self.req_opts)
- check = self.checkDownload({"bad": "bad try"})
+ 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":
+ self.setWait(300, True)
+ self.wait()
+ self.retry()
+ if check == "empty":
+ self.fail("File not downloadable")
+ if check == "wrong_captcha":
+ self.invalidCaptcha()
+ self.retry()
def prepare(self):
pyfile = self.pyfile
@@ -61,6 +74,7 @@ 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):
@@ -105,16 +119,11 @@ class FreakshareCom(Hoster):
if self.html is None:
self.download_html()
- if "Der Traffic f\xc3\xbcr heute ist verbraucht!" in self.html or "Your Traffic is used up for today" in self.html:
+ if "Your Traffic is used up for today" in self.html:
self.wantReconnect = True
return 24*3600
- if re.search(r"This file does not exist!", self.html) is not None:
- self.offline()
- timestring = re.search('\s*var\sdownloadWait\s=\s(\d*);', self.html)
- if timestring:
- return int(timestring.group(1)) + 1 #add 1 sec as tenths of seconds are cut off
- timestring = re.search('\s*var\stime\s=\s(\d*)[.0];', 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
else:
@@ -126,7 +135,7 @@ class FreakshareCom(Hoster):
"""
if self.html is None:
self.download_html()
- if re.search(r"Sorry, this Download doesnt exist anymore", self.html) is not None:
+ if re.search(r"This file does not exist!", self.html) is not None:
return False
else:
return True
@@ -134,10 +143,7 @@ class FreakshareCom(Hoster):
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
to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
- request_options = []
-
- for item in to_sort: #Name value pairs are output reversed from regex, so we reorder them
- request_options.append((item[1], item[0]))
+ request_options = dict((n, v) for (v, n) in to_sort)
herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page
@@ -146,21 +152,16 @@ class FreakshareCom(Hoster):
# fp.write(herewego)
to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
- request_options = []
+ 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])
-
- for item in to_sort: #Same as above
- request_options.append((item[1], item[0]))
challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego)
if challenge:
re_captcha = ReCaptcha(self)
- challenge, result = re_captcha.challenge(challenge.group(1))
-
- request_options.append(("recaptcha_challenge_field", challenge))
- request_options.append(("recaptcha_response_field", result))
+ request_options["recaptcha_challenge_field"], request_options["recaptcha_response_field"] \
+ = re_captcha.challenge(challenge.group(1))
return request_options