diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/hoster/FreakshareNet.py | 80 | ||||
| -rw-r--r-- | module/plugins/hoster/HotfileCom.py | 86 | ||||
| -rw-r--r-- | module/plugins/hoster/StorageTo.py | 58 | 
3 files changed, 112 insertions, 112 deletions
| diff --git a/module/plugins/hoster/FreakshareNet.py b/module/plugins/hoster/FreakshareNet.py index e772c84c2..107072359 100644 --- a/module/plugins/hoster/FreakshareNet.py +++ b/module/plugins/hoster/FreakshareNet.py @@ -12,44 +12,43 @@ class FreakshareNet(Hoster):      __name__ = "FreakshareNet"      __type__ = "hoster"      __pattern__ = r"http://(?:www\.)?freakshare\.net/files/\S*?/" -    __version__ = "0.1" +    __version__ = "0.2"      __description__ = """Freakshare.com Download Hoster"""      __author_name__ = ("sitacuisses","spoob","mkaay")      __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") -    def __init__(self, parent): -        Hoster.__init__(self, parent) -        self.parent = parent +    def setup(self):          self.html = None -        self.want_reconnect = False -        self.multi_dl = False -        self.req_opts = list() +        self.wantReconnect = False +        self.multiDL = False +        self.req_opts = [] + +    def process(self, pyfile): +        self.pyfile = pyfile +        self.prepare() +        self.proceed( self.get_file_url() ) +         -    def prepare(self, thread): -        pyfile = self.parent +    def prepare(self): +        pyfile = self.pyfile -        self.want_reconnect = False +        self.wantReconnect = False          self.download_html() -         -        pyfile.status.exists = self.file_exists() -        if not pyfile.status.exists: -            return False +        if not self.file_exists(): +            self.offline -        self.get_waiting_time() +        self.setWait( self.get_waiting_time() ) -        pyfile.status.filename = self.get_file_name() +        pyfile.name = self.get_file_name() -        pyfile.status.waituntil = self.time_plus_wait -        thread.wait(self.parent) -        pyfile.status.url = self.get_file_url() -        pyfile.status.want_reconnect = self.want_reconnect +        self.wait()          return True      def download_html(self): -        url = self.parent.url +        url = self.pyfile.url          self.html = self.load(url, cookies=True)      def get_file_url(self): @@ -57,21 +56,21 @@ class FreakshareNet(Hoster):          """          if self.html == None:              self.download_html() -        if not self.want_reconnect: +        if not self.wantReconnect:              self.req_opts = self.get_download_options() # get the Post options for the Request -            file_url = self.parent.url +            file_url = self.pyfile.url              return file_url          else: -            return False +            self.offline()      def get_file_name(self):          if self.html == None:              self.download_html() -        if not self.want_reconnect: +        if not self.wantReconnect:              file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center\;\">(.*?)<\/h1>", self.html).group(1)              return file_name          else: -            return self.parent.url +            return self.pyfile.url      def get_waiting_time(self):          if self.html == None: @@ -81,7 +80,7 @@ class FreakshareNet(Hoster):              sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off          else:              sec = 0 -        self.time_plus_wait = time() + sec +        return sec      def file_exists(self):          """ returns True or False @@ -96,18 +95,22 @@ class FreakshareNet(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 = list() +        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.parent.url, None, request_options, cookies=True) # the actual download-Page -        to_sort = None +            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"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) -        request_options = list() +        request_options = [] +                  for item in to_sort:       #Same as above -         request_options.append((item[1], item[0])) +            request_options.append((item[1], item[0])) +          return request_options -    def proceed(self, url, location): +    def proceed(self, url):          """          request.download doesn't handle the 302 redirect correctly          that's why the data are posted "manually" via httplib @@ -117,12 +120,14 @@ class FreakshareNet(Hoster):          Need to come up with a better idea to handle the redirect,          help is appreciated.          """ +                  temp_options = urllib.urlencode(self.req_opts)          temp_url = re.match(r"http://(.*?)/.*", url).group(1) # get the server name          temp_extended = re.match(r"http://.*?(/.*)", url).group(1) # get the url relative to serverroot          cookie_list = ""          for temp_cookie in self.req.cookies: #prepare cookies -         cookie_list += temp_cookie.name + "=" + temp_cookie.value +";" +            cookie_list += temp_cookie.name + "=" + temp_cookie.value +";" +                      temp_headers = [  #create the additional header fields          ["Content-type", "application/x-www-form-urlencoded"], #this is very important          ["User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10"], @@ -133,9 +138,12 @@ class FreakshareNet(Hoster):          ["Keep-Alive", "300"],          ["Referer", self.req.lastURL],          ["Cookie", cookie_list]] +                  temp_conn = httplib.HTTPConnection(temp_url)          temp_conn.request("POST", temp_extended, temp_options, dict(temp_headers)) +                  temp_response = temp_conn.getresponse()          new_url = temp_response.getheader("Location") # we need the Location-header          temp_conn.close -        self.download(new_url, location, cookies=False) + +        self.download(new_url, cookies=False) diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index a606619cd..5f1a5901e 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -9,66 +9,65 @@ class HotfileCom(Hoster):      __name__ = "HotfileCom"      __type__ = "hoster"      __pattern__ = r"http://hotfile.com/dl/" -    __version__ = "0.1" +    __version__ = "0.2"      __description__ = """Hotfile.com Download Hoster"""      __author_name__ = ("sitacuisses","spoob","mkaay")      __author_mail__ = ("sitacuisses@yhoo.de","spoob@pyload.org","mkaay@mkaay.de") -    def __init__(self, parent): -        Hoster.__init__(self, parent) -        self.parent = parent +    def setup(self):          self.html = [None, None] -        self.want_reconnect = False -        self.multi_dl = False +        self.wantReconnect = False +        self.multiDL = False          self.htmlwithlink = None          self.url = None -        self.read_config() -        if self.config['premium']: -            self.multi_dl = True -            self.req.canContinue = True -        else: -            self.multi_dl = False -    def prepare(self, thread): -        pyfile = self.parent -        self.want_reconnect = False +        # if self.config['premium']: +            # self.multiDL = True +            # self.req.canContinue = True +         +    def process(self, pyfile): +        self.pyfile = pyfile         +        self.prepare() +        self.download( self.get_file_url() ) + +         +    def prepare(self): +        pyfile = self.pyfile +        self.wantReconnect = False          self.download_html() -        pyfile.status.exists = self.file_exists() -        if not pyfile.status.exists: -            return False +        if not self.file_exists(): +            self.offline() -        pyfile.status.filename = self.get_file_name() +        pyfile.name = self.get_file_name() -        if self.config['premium']: -            pyfile.status.url = self.get_file_url() -            return True +        # if self.config['premium']: +            # pyfile.status.url = self.get_file_url() +            # return True -        self.get_wait_time() -        pyfile.status.waituntil = self.time_plus_wait -        pyfile.status.want_reconnect = self.want_reconnect +        self.setWait( self.get_wait_time() ) +        self.wait() -        thread.wait(self.parent) -         -        pyfile.status.url = self.get_file_url()          return True      def download_html(self): -        if self.config['premium']: -            self.req.add_auth(self.config['username'], self.config['password']) -        self.url = self.parent.url -        self.html[0] = self.load(self.url, get={"lang":"en"}, cookies=True) +        # if self.config['premium']: +            # self.req.add_auth(self.config['username'], self.config['password']) +        self.html[0] = self.load(self.parent.url, get={"lang":"en"}, cookies=True)      def get_file_url(self): -        if self.config['premium']: -            file_url_pattern = r'<td><a href="(http://hotfile.com/get/.+?)" class="click_download">' -            file_url = re.search(file_url_pattern, self.html[0]).group(1) -        else: -            form_content = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html[0]).group(0) -            form_posts = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content) -            self.html[1] = self.load(self.url, post=form_posts, cookies=True) -            file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.html[1]).group(1) +        # if self.config['premium']: +            # file_url_pattern = r'<td><a href="(http://hotfile.com/get/.+?)" class="click_download">' +            # file_url = re.search(file_url_pattern, self.html[0]).group(1) +        # else: +         +        form_content = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html[0]).group(0) +        form_posts = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content) +         +        self.html[1] = self.load(self.parent.url, post=form_posts, cookies=True) +         +        file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.html[1]).group(1)          return file_url      def get_file_name(self): @@ -90,7 +89,6 @@ class HotfileCom(Hoster):                  if int(match) == 0:                      continue                  else: -                    self.time_plus_wait = time() + int(match)/1000 + 65 -                    self.want_reconnect = True -                    return True -            self.time_plus_wait = time() + 65 +                    self.wantReconnect = True +                    return int(match)/1000 + 65 +            return 65 diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py index d0a332baf..f0660b40d 100644 --- a/module/plugins/hoster/StorageTo.py +++ b/module/plugins/hoster/StorageTo.py @@ -10,49 +10,43 @@ class StorageTo(Hoster):      __name__ = "StorageTo"      __type__ = "hoster"      __pattern__ = r"http://(?:www)?\.storage\.to/get/.*" -    __version__ = "0.1" +    __version__ = "0.2"      __description__ = """Storage.to Download Hoster"""      __author_name__ = ("mkaay") -    def __init__(self, parent): -        Hoster.__init__(self, parent) -        self.parent = parent -        self.time_plus_wait = None -        self.want_reconnect = False +    def setup(self): +        self.wantReconnect = False          self.api_data = None          self.html = None -        self.read_config() -        self.multi_dl = False - -        self.start_dl = False +        self.multiDL = False +         +    def process(self, pyfile): +        self.pyfile = pyfile +        self.prepare() +        self.download( self.get_file_url() ) +         +         +         -    def prepare(self, thread): -        pyfile = self.parent +    def prepare(self): +        pyfile = self.pyfile          self.req.clear_cookies() -        self.want_reconnect = False +        self.wantReconnect = False -        pyfile.status.exists = self.file_exists() +        if not self.file_exists(): +            self.offline() -        if not pyfile.status.exists: -            return False - -        pyfile.status.filename = self.get_file_name() +        pyfile.name = self.get_file_name() -        self.get_wait_time() -        pyfile.status.waituntil = self.time_plus_wait -        pyfile.status.want_reconnect = self.want_reconnect +        self.setWait( self.get_wait_time() ) -        while self.want_reconnect: -            thread.wait(self.parent) +        while self.wantReconnect: +            self.wait()              self.download_api_data() -            self.get_wait_time() -            pyfile.status.waituntil = self.time_plus_wait -            pyfile.status.want_reconnect = self.want_reconnect +            self.setWait(  self.get_wait_time() ) -        pyfile.status.url = self.get_file_url() -          return True      def download_html(self): @@ -73,11 +67,11 @@ class StorageTo(Hoster):          if not self.api_data:              self.download_api_data()          if self.api_data["state"] == "wait": -            self.want_reconnect = True +            self.wantReconnect = True          else: -            self.want_reconnect = False -         -        self.time_plus_wait = time() + int(self.api_data["countdown"]) + 3 +            self.wantReconnect = False +             +        return int(self.api_data["countdown"]) + 3 | 
