From 1edbe8364951623aacf7c6477ce651394f513eec Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 6 Oct 2010 14:09:26 +0200 Subject: freakshare.com, netload fix --- module/plugins/hoster/FreakshareCom.py | 125 +++++++++++++++++++++++++++++++++ module/plugins/hoster/FreakshareNet.py | 124 -------------------------------- module/plugins/hoster/NetloadIn.py | 15 ++-- 3 files changed, 129 insertions(+), 135 deletions(-) create mode 100644 module/plugins/hoster/FreakshareCom.py delete mode 100644 module/plugins/hoster/FreakshareNet.py diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py new file mode 100644 index 000000000..524081002 --- /dev/null +++ b/module/plugins/hoster/FreakshareCom.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster +from module.plugins.ReCaptcha import ReCaptcha + +class FreakshareCom(Hoster): + __name__ = "FreakshareCom" + __type__ = "hoster" + __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" + __version__ = "0.32" + __description__ = """Freakshare.com Download Hoster""" + __author_name__ = ("sitacuisses","spoob","mkaay") + __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") + + def setup(self): + self.html = None + self.wantReconnect = False + self.multiDL = False + self.req_opts = [] + + def process(self, pyfile): + pyfile.url = pyfile.url.replace("freakshare.net/","freakshare.com/") + + self.prepare() + self.get_file_url() + + self.download(self.pyfile.url, post=self.req_opts) + + + 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() + + self.wait() + + return True + + def download_html(self): + url = self.pyfile.url.replace("freakshare.net/","freakshare.com/") + self.html = self.load(url, cookies=True) + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + 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 + #file_url = self.pyfile.url + #return file_url + else: + self.offline() + + def get_file_name(self): + if self.html is None: + self.download_html() + if not self.wantReconnect: + file_name = re.search(r"([^ ]+)", self.html).group(1) + return file_name + else: + return self.pyfile.url + + def get_waiting_time(self): + 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: + self.wantReconnect = True + return 24*3600 + + timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) + if timestring: + sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off + else: + sec = 0 + return sec + + def file_exists(self): + """ returns True or False + """ + if self.html is None: + self.download_html() + if re.search(r"Sorry, this Download doesnt exist anymore", self.html) is not None: + return False + else: + return True + + def get_download_options(self): + re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?", self.html).group(0) #get the whole request + to_sort = re.findall(r"", 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])) + + herewego = self.load(self.pyfile.url, None, request_options, cookies=True) # the actual download-Page + + to_sort = re.findall(r"", herewego) + request_options = [] + + 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)) + + return request_options \ No newline at end of file diff --git a/module/plugins/hoster/FreakshareNet.py b/module/plugins/hoster/FreakshareNet.py deleted file mode 100644 index 18048704a..000000000 --- a/module/plugins/hoster/FreakshareNet.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re -from module.plugins.Hoster import Hoster -from module.plugins.ReCaptcha import ReCaptcha - -class FreakshareNet(Hoster): - __name__ = "FreakshareNet" - __type__ = "hoster" - __pattern__ = r"http://(?:www\.)?freakshare\.net/files/\S*?/" - __version__ = "0.32" - __description__ = """Freakshare.com Download Hoster""" - __author_name__ = ("sitacuisses","spoob","mkaay") - __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") - - def setup(self): - self.html = None - self.wantReconnect = False - self.multiDL = False - self.req_opts = [] - - def process(self, pyfile): - self.pyfile = pyfile - self.prepare() - self.get_file_url() - - self.download(self.pyfile.url, post=self.req_opts) - - - 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() - - self.wait() - - return True - - def download_html(self): - url = self.pyfile.url - self.html = self.load(url, cookies=True) - - def get_file_url(self): - """ returns the absolute downloadable filepath - """ - 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 - #file_url = self.pyfile.url - #return file_url - else: - self.offline() - - def get_file_name(self): - if self.html is None: - self.download_html() - if not self.wantReconnect: - file_name = re.search(r"([^ ]+)", self.html).group(1) - return file_name - else: - return self.pyfile.url - - def get_waiting_time(self): - 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: - self.wantReconnect = True - return 24*3600 - - timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) - if timestring: - sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off - else: - sec = 0 - return sec - - def file_exists(self): - """ returns True or False - """ - if self.html is None: - self.download_html() - if re.search(r"Sorry, this Download doesnt exist anymore", self.html) is not None: - return False - else: - return True - - def get_download_options(self): - re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?", self.html).group(0) #get the whole request - to_sort = re.findall(r"", 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])) - - herewego = self.load(self.pyfile.url, None, request_options, cookies=True) # the actual download-Page - - to_sort = re.findall(r"", herewego) - request_options = [] - - 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)) - - return request_options \ No newline at end of file diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 369cd9189..d03b86d5e 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -164,26 +164,19 @@ class NetloadIn(Hoster): self.setWait(wait) self.wait() - link = re.search(r"You can download now your next file. Click here for the download", page) - if link is not None: - self.log.debug("Netload: Using new link found on page") - page = self.load("http://netload.in/" + link.group(1).replace("amp;", "")) - else: - self.log.debug("Netload: No new link found, using old one") - page = self.load(self.url, cookies=True) - continue + return self.download_html() self.log.debug("Netload: Trying to find captcha") - url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") - page = self.load(url_captcha_html, cookies=True) - try: + url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") + page = self.load(url_captcha_html, cookies=True) captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1) except: open("dump.html", "w").write(page) self.log.debug("Netload: Could not find captcha, try again from beginning") + captchawaited = False continue file_id = re.search('', page).group(1) -- cgit v1.2.3