diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/accounts/RapidgatorNet.py | 14 | ||||
| -rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 26 | ||||
| -rw-r--r-- | module/plugins/hoster/UploadedTo.py | 42 | 
3 files changed, 32 insertions, 50 deletions
diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index bc4356e4a..45a80947a 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -27,9 +27,11 @@ class RapidgatorNet(Account):              sid = self.getAccountData(user).get('sid')              assert sid -            json = req.load("%s/info" % self.API_URL, get={'sid': sid}) -            self.logDebug("API:USERINFO", json) -            json = json_loads(json) +            html = req.load("%s/info" % self.API_URL, get={'sid': sid}) + +            self.logDebug("API:USERINFO", html) + +            json = json_loads(html)              if json['response_status'] == 200:                  if "reset_in" in json['response']: @@ -52,11 +54,11 @@ class RapidgatorNet(Account):      def login(self, user, data, req):          try: -            json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) +            html = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) -            self.logDebug("API:LOGIN", json) +            self.logDebug("API:LOGIN", html) -            json = json_loads(json) +            json = json_loads(html)              if json['response_status'] == 200:                  data['sid'] = str(json['response']['session_id']) diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 94a240d4c..7ece12781 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -20,24 +20,13 @@ def forward(source, destination):  #: socket.create_connection wrapper for python 2.5  def create_connection(address, timeout=object(), source_address=None): -    try: -        return socket.create_connection(address, -                                        socket._GLOBAL_DEFAULT_TIMEOUT if type(timeout) == object else timeout, -                                        source_address) - -    except SyntaxError: -        """Connect to *address* and return the socket object. - -        Convenience function.  Connect to *address* (a 2-tuple ``(host, -        port)``) and return the socket object.  Passing the optional -        *timeout* parameter will set the timeout on the socket instance -        before attempting to connect.  If no *timeout* is supplied, the -        global default timeout setting returned by :func:`getdefaulttimeout` -        is used.  If *source_address* is set it must be a tuple of (host, port) -        for the socket to bind as a source address before making the connection. -        An host of \'\' or port 0 tells the OS to use the default. -        """ +    if hasattr(socket, 'create_connection'): +        if type(timeout) == object: +            timeout = socket._GLOBAL_DEFAULT_TIMEOUT +        return socket.create_connection(address, timeout, source_address) + +    else:          host, port = address          err = None          for res in getaddrinfo(host, port, 0, SOCK_STREAM): @@ -66,7 +55,7 @@ def create_connection(address, timeout=object(), source_address=None):  class ClickAndLoad(Hook):      __name__    = "ClickAndLoad"      __type__    = "hook" -    __version__ = "0.31" +    __version__ = "0.32"      __config__ = [("activated", "bool", "Activated"                                     , True ),                    ("port"     , "int" , "Port"                                          , 9666 ), @@ -114,6 +103,7 @@ class ClickAndLoad(Hook):          except socket.error, e:              self.logError(e) +            self.server(ip, webport, cnlport)          finally:              dock_socket.close() diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 150b69534..995b766b4 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,8 +1,4 @@  # -*- coding: utf-8 -*- -# -# Test links: -# http://ul.to/044yug9o -# http://ul.to/gzfhd0xs  import re @@ -16,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class UploadedTo(SimpleHoster):      __name__    = "UploadedTo"      __type__    = "hoster" -    __version__ = "0.79" +    __version__ = "0.81"      __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' @@ -25,15 +21,13 @@ class UploadedTo(SimpleHoster):      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    API_KEY = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw="  #@NOTE: base64 encoded +    API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL"      URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] -    INFO_PATTERN    = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a>  \s*<small[^>]*>(?P<S>[^<]+)</small>' -    OFFLINE_PATTERN = r'<small class="cL">Error: 404' -      LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' +    WAIT_PATTERN   = r'Current waiting period: <span>(\d+)'      DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' @@ -42,18 +36,16 @@ class UploadedTo(SimpleHoster):          info = super(UploadedTo, cls).apiInfo(url)          for _i in xrange(5): -            api = getURL("http://uploaded.net/api/filemultiple", -                         post={"apikey": cls.API_KEY.decode('base64'), 'id_0': re.match(cls.__pattern__, url).group('ID')}, +            html = getURL("http://uploaded.net/api/filemultiple", +                         get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')},                           decode=True) -            if api != "can't find request": -                api = api.splitlines()[0].split(",", 4) - -                if api[0] == "online": -                    info.update({'name': api[4], 'size': api[2], 'status': 2}) -                elif api[0] == "offline": +            if html != "can't find request": +                api = html.split(",", 4) +                if api[0] == "offline":                      info['status'] = 1 - +                else: +                    info.update({'name': api[4], 'size': api[2], 'status': 2})                  break              else:                  sleep(3) @@ -72,14 +64,7 @@ class UploadedTo(SimpleHoster):              self.logError(_("Free-download capacities exhausted"))              self.retry(24, 5 * 60) -        if not self.premium: -            m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) -            if m: -                self.wait(m.group(1)) -            else: -                self.fail(_("File not downloadable for free users")) - -        if "limit-size" in self.html: +        elif "limit-size" in self.html:              self.fail(_("File too big for free download"))          elif "limit-slot" in self.html:  # Temporary restriction so just wait a bit @@ -96,6 +81,11 @@ class UploadedTo(SimpleHoster):          elif '"err":"captcha"' in self.html:              self.invalidCaptcha() +        else: +            m = re.search(self.WAIT_PATTERN, self.html) +            if m: +                self.wait(m.group(1)) +      def handleFree(self, pyfile):          self.html = self.load("http://uploaded.net/js/download.js", decode=True)  | 
