diff options
| author | 2015-08-09 00:50:54 +0200 | |
|---|---|---|
| committer | 2015-08-09 00:50:54 +0200 | |
| commit | b0ef3f1673e1930916604bb1264ca3a38414bc8d (patch) | |
| tree | c97936e4d2a4cd6eb1072c65c8a08a7d18816b18 /module/plugins/crypter | |
| parent | [XFileSharingPro][XFileSharingProFolder] Added default __pattern__ (diff) | |
| parent | Fix https://github.com/pyload/pyload/issues/1707 (diff) | |
| download | pyload-b0ef3f1673e1930916604bb1264ca3a38414bc8d.tar.xz | |
Merge pull request #1 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/crypter')
88 files changed, 1056 insertions, 803 deletions
| diff --git a/module/plugins/crypter/BitshareComFolder.py b/module/plugins/crypter/BitshareComFolder.py index 256c5b5aa..d7a51cb1c 100644 --- a/module/plugins/crypter/BitshareComFolder.py +++ b/module/plugins/crypter/BitshareComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class BitshareComFolder(SimpleCrypter):      __name__    = "BitshareComFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.05" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -19,7 +20,7 @@ class BitshareComFolder(SimpleCrypter):      LINK_PATTERN = r'<a href="(http://bitshare\.com/files/.+)">.+</a></td>' -    NAME_PATTERN = r'View public folder "(?P<N>.+)"</h1>' +    NAME_PATTERN = r'View public folder "(?P<N>.+?)"</h1>'  getInfo = create_getInfo(BitshareComFolder) diff --git a/module/plugins/crypter/C1NeonCom.py b/module/plugins/crypter/C1NeonCom.py index 9b6093081..09acace63 100644 --- a/module/plugins/crypter/C1NeonCom.py +++ b/module/plugins/crypter/C1NeonCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class C1NeonCom(DeadCrypter):      __name__    = "C1NeonCom"      __type__    = "crypter" -    __version__ = "0.05" +    __version__ = "0.06" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?c1neon\.com/.+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py index f535da48d..3604635e5 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/crypter/ChipDe.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class ChipDe(Crypter):      __name__    = "ChipDe"      __type__    = "crypter" -    __version__ = "0.10" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?chip\.de/video/.+\.html'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -26,4 +27,4 @@ class ChipDe(Crypter):              self.fail(_("Failed to find the URL"))          else:              self.urls = [f.group(1)] -            self.logDebug("The file URL is %s" % self.urls[0]) +            self.log_debug("The file URL is %s" % self.urls[0]) diff --git a/module/plugins/crypter/CloudzillaToFolder.py b/module/plugins/crypter/CloudzillaToFolder.py index 96d7245f1..09b4d4c08 100644 --- a/module/plugins/crypter/CloudzillaToFolder.py +++ b/module/plugins/crypter/CloudzillaToFolder.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class CloudzillaToFolder(SimpleHoster):      __name__    = "CloudzillaToFolder"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/folder/(?P<ID>[\w^_]+)' @@ -26,10 +27,10 @@ class CloudzillaToFolder(SimpleHoster):      PASSWORD_PATTERN = r'<div id="pwd_protected">' -    def checkErrors(self): +    def check_errors(self):          m = re.search(self.PASSWORD_PATTERN, self.html)          if m: -            self.html = self.load(self.pyfile.url, get={'key': self.getPassword()}) +            self.html = self.load(self.pyfile.url, get={'key': self.get_password()})          if re.search(self.PASSWORD_PATTERN, self.html):              self.retry(reason="Wrong password") diff --git a/module/plugins/crypter/CrockoComFolder.py b/module/plugins/crypter/CrockoComFolder.py index f56cc449a..81dfcd525 100644 --- a/module/plugins/crypter/CrockoComFolder.py +++ b/module/plugins/crypter/CrockoComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class CrockoComFolder(SimpleCrypter):      __name__    = "CrockoComFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?crocko\.com/f/.+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/CryptItCom.py b/module/plugins/crypter/CryptItCom.py index 1c9e841b7..be0094747 100644 --- a/module/plugins/crypter/CryptItCom.py +++ b/module/plugins/crypter/CryptItCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class CryptItCom(DeadCrypter):      __name__    = "CryptItCom"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareComFolder.py index c317b1b49..cb41426d7 100644 --- a/module/plugins/crypter/CzshareComFolder.py +++ b/module/plugins/crypter/CzshareComFolder.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class CzshareComFolder(Crypter):      __name__    = "CzshareComFolder"      __type__    = "crypter" -    __version__ = "0.20" +    __version__ = "0.22" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/folders/.+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 01caa0bb8..8a4a0f258 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -4,14 +4,15 @@ import re  import urlparse  from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.utils import save_join +from module.plugins.internal.Crypter import Crypter +from module.utils import save_join as fs_join  class DailymotionComFolder(Crypter):      __name__    = "DailymotionComFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\w^_]+)(?(TYPE)|#)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -22,16 +23,16 @@ class DailymotionComFolder(Crypter):      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    def api_response(self, ref, req=None): +    def api_response(self, ref, data=None):          url  = urlparse.urljoin("https://api.dailymotion.com/", ref) -        html = self.load(url, get=req) +        html = self.load(url, get=data)          return json_loads(html) -    def getPlaylistInfo(self, id): -        ref = "playlist/" + id -        req = {"fields": "name,owner.screenname"} -        playlist = self.api_response(ref, req) +    def get_playlist_info(self, id): +        ref  = "playlist/" + id +        data = {'fields': "name,owner.screenname"} +        playlist = self.api_response(ref, data)          if "error" in playlist:              return @@ -41,10 +42,10 @@ class DailymotionComFolder(Crypter):          return name, owner -    def _getPlaylists(self, user_id, page=1): -        ref = "user/%s/playlists" % user_id -        req = {"fields": "id", "page": page, "limit": 100} -        user = self.api_response(ref, req) +    def _get_playlists(self, user_id, page=1): +        ref  = "user/%s/playlists" % user_id +        data = {'fields': "id", 'page': page, 'limit': 100} +        user = self.api_response(ref, data)          if "error" in user:              return @@ -53,18 +54,18 @@ class DailymotionComFolder(Crypter):              yield playlist['id']          if user['has_more']: -            for item in self._getPlaylists(user_id, page + 1): +            for item in self._get_playlists(user_id, page + 1):                  yield item -    def getPlaylists(self, user_id): -        return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] +    def get_playlists(self, user_id): +        return [(id,) + self.get_playlist_info(id) for id in self._get_playlists(user_id)] -    def _getVideos(self, id, page=1): -        ref = "playlist/%s/videos" % id -        req = {"fields": "url", "page": page, "limit": 100} -        playlist = self.api_response(ref, req) +    def _get_videos(self, id, page=1): +        ref  = "playlist/%s/videos" % id +        data = {'fields': "url", 'page': page, 'limit': 100} +        playlist = self.api_response(ref, data)          if "error" in playlist:              return @@ -73,12 +74,12 @@ class DailymotionComFolder(Crypter):              yield video['url']          if playlist['has_more']: -            for item in self._getVideos(id, page + 1): +            for item in self._get_videos(id, page + 1):                  yield item -    def getVideos(self, playlist_id): -        return list(self._getVideos(playlist_id))[::-1] +    def get_videos(self, playlist_id): +        return list(self._get_videos(playlist_id))[::-1]      def decrypt(self, pyfile): @@ -87,19 +88,19 @@ class DailymotionComFolder(Crypter):          m_type = m.group('TYPE')          if m_type == "playlist": -            self.logDebug("Url recognized as Playlist") -            p_info = self.getPlaylistInfo(m_id) +            self.log_debug("Url recognized as Playlist") +            p_info = self.get_playlist_info(m_id)              playlists = [(m_id,) + p_info] if p_info else None          else: -            self.logDebug("Url recognized as Channel") -            playlists = self.getPlaylists(m_id) -            self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) +            self.log_debug("Url recognized as Channel") +            playlists = self.get_playlists(m_id) +            self.log_debug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id))          if not playlists:              self.fail(_("No playlist available"))          for p_id, p_name, p_owner in playlists: -            p_videos = self.getVideos(p_id) -            p_folder = save_join(self.config['general']['download_folder'], p_owner, p_name) -            self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) -            self.packages.append((p_name, p_videos, p_folder))  #: folder is NOT recognized by pyload 0.4.9! +            p_videos = self.get_videos(p_id) +            p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p_owner, p_name) +            self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) +            self.packages.append((p_name, p_videos, p_folder))  #: Folder is NOT recognized by pyload 0.4.9! diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index 67f5e788f..e6e3c70a5 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class DataHuFolder(SimpleCrypter):      __name__    = "DataHuFolder"      __type__    = "crypter" -    __version__ = "0.06" +    __version__ = "0.08" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -22,22 +23,22 @@ class DataHuFolder(SimpleCrypter):      LINK_PATTERN = r'<a href=\'(http://data\.hu/get/.+)\' target=\'_blank\'>\1</a>' -    NAME_PATTERN = ur'<title>(?P<N>.+) Let\xf6lt\xe9se</title>' +    NAME_PATTERN = ur'<title>(?P<N>.+?) Let\xf6lt\xe9se</title>'      def prepare(self):          super(DataHuFolder, self).prepare() -        if u'K\xe9rlek add meg a jelsz\xf3t' in self.html:  # Password protected -            password = self.getPassword() +        if u'K\xe9rlek add meg a jelsz\xf3t' in self.html:  #: Password protected +            password = self.get_password()              if not password:                  self.fail(_("Password required")) -            self.logDebug("The folder is password protected', 'Using password: " + password) +            self.log_debug("The folder is password protected', 'Using password: " + password) -            self.html = self.load(self.pyfile.url, post={'mappa_pass': password}, decode=True) +            self.html = self.load(self.pyfile.url, post={'mappa_pass': password}) -            if u'Hib\xe1s jelsz\xf3' in self.html:  # Wrong password +            if u'Hib\xe1s jelsz\xf3' in self.html:  #: Wrong password                  self.fail(_("Wrong password")) diff --git a/module/plugins/crypter/DdlstorageComFolder.py b/module/plugins/crypter/DdlstorageComFolder.py index dc6ec1da5..ffc9f1d01 100644 --- a/module/plugins/crypter/DdlstorageComFolder.py +++ b/module/plugins/crypter/DdlstorageComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class DdlstorageComFolder(DeadCrypter):      __name__    = "DdlstorageComFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/folder/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/DepositfilesComFolder.py b/module/plugins/crypter/DepositfilesComFolder.py index 46ec265c3..0c795279e 100644 --- a/module/plugins/crypter/DepositfilesComFolder.py +++ b/module/plugins/crypter/DepositfilesComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class DepositfilesComFolder(SimpleCrypter):      __name__    = "DepositfilesComFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?depositfiles\.com/folders/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 8e56a7bfc..9051abcc2 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -1,12 +1,15 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer +import re +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class Dereferer(SimpleDereferer): + +class Dereferer(SimpleCrypter):      __name__    = "Dereferer"      __type__    = "crypter" -    __version__ = "0.12" +    __version__ = "0.18" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -21,24 +24,18 @@ class Dereferer(SimpleDereferer):      HOSTER_NAME   = None -    def _log(self, type, args): -        msg = " | ".join(str(a).strip() for a in args if a) -        logger = getattr(self.log, type) -        logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) +    def _log(self, level, plugintype, pluginname, messages): +        return super(Dereferer, self)._log(level, plugintype, pluginname, (self.HOSTER_NAME,) + messages)      def init(self):          super(Dereferer, self).init() -        self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern']  #@TODO: Recheck in 0.4.10 +        self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern']  #@TODO: Recheck in 0.4.10          self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()          self.HOSTER_NAME   = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') -    def getLink(self): -        try: -            return re.match(self.__pattern__, pyfile.url).group('LINK').strip() - -        except Exception, e: -            self.logWarning(e) +    def get_links(self): +        return [re.match(self.__pattern__, self.pyfile.url).group('LINK').strip()] diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 4d15e2058..8340adeb8 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -12,14 +12,15 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class DevhostStFolder(SimpleCrypter):      __name__    = "DevhostStFolder"      __type__    = "crypter" -    __version__ = "0.05" +    __version__ = "0.06" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True),                     ("use_subfolder"     , "bool", "Save package to subfolder"          , True),                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] -    __description__ = """d-h.st folder decrypter plugin""" +    __description__ = """D-h.st folder decrypter plugin"""      __license__     = "GPLv3"      __authors__     = [("zapp-brannigan", "fuerst.reinje@web.de"),                         ("Walter Purcaro", "vuolter@gmail.com")] @@ -29,11 +30,11 @@ class DevhostStFolder(SimpleCrypter):      OFFLINE_PATTERN = r'"/cHP">test\.png<' -    def checkNameSize(self, getinfo=True): +    def check_name_size(self, getinfo=True):          if not self.info or getinfo: -            self.logDebug("File info (BEFORE): %s" % self.info) -            self.info.update(self.getInfo(self.pyfile.url, self.html)) -            self.logDebug("File info (AFTER): %s"  % self.info) +            self.log_debug("File info (BEFORE): %s" % self.info) +            self.info.update(self.get_info(self.pyfile.url, self.html)) +            self.log_debug("File info (AFTER): %s"  % self.info)          try:              if self.info['pattern']['ID'] == "0": @@ -49,7 +50,7 @@ class DevhostStFolder(SimpleCrypter):              self.pyfile.name = m.group(1)          except Exception, e: -            self.logDebug(e) +            self.log_debug(e)              self.pyfile.name = self.info['pattern']['USER']          try: @@ -58,7 +59,7 @@ class DevhostStFolder(SimpleCrypter):          except Exception:              pass -        self.logDebug("File name: %s"   % self.pyfile.name, +        self.log_debug("File name: %s"   % self.pyfile.name,                        "File folder: %s" % self.pyfile.name) diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index a9f39c6f3..0c776ac61 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -11,7 +11,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class DlProtectCom(SimpleCrypter):      __name__    = "DlProtectCom"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.05" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?dl-protect\.com/((en|fr)/)?\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -28,15 +29,15 @@ class DlProtectCom(SimpleCrypter):      OFFLINE_PATTERN = r'Unfortunately, the link you are looking for is not found' -    def getLinks(self): -        # Direct link with redirect +    def get_links(self): +        #: Direct link with redirect          if not re.match(r"https?://(?:www\.)?dl-protect\.com/.+", self.req.http.lastEffectiveURL):              return [self.req.http.lastEffectiveURL]          post_req = {'key'       : re.search(r'name="key" value="(.+?)"', self.html).group(1),                      'submitform': ""} -        if "Please click on continue to see the content" in self.html: +        if "Please click on continue to see the links" in self.html:              post_req['submitform'] = "Continue"              self.wait(2) @@ -48,14 +49,13 @@ class DlProtectCom(SimpleCrypter):                               'submitform': "Decrypt+link"})              if "Password :" in self.html: -                post_req['pwd'] = self.getPassword() +                post_req['pwd'] = self.get_password()              if "Security Code" in self.html: -                captcha_id   = re.search(r'/captcha\.php\?uid=(.+?)"', self.html).group(1) -                captcha_url  = "http://www.dl-protect.com/captcha.php?uid=" + captcha_id -                captcha_code = self.decryptCaptcha(captcha_url, imgtype="gif") - -                post_req['secure'] = captcha_code +                m = re.search(r'/captcha\.php\?key=(.+?)"', self.html) +                if m: +                    captcha_code = self.captcha.decrypt("http://www.dl-protect.com/captcha.php?key=" + m.group(1), input_type="gif") +                    post_req['secure'] = captcha_code          self.html = self.load(self.pyfile.url, post=post_req) diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index cc108d101..c9269b05e 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -2,15 +2,16 @@  import re -from BeautifulSoup import BeautifulSoup +import BeautifulSoup -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class DuckCryptInfo(Crypter):      __name__    = "DuckCryptInfo"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -31,29 +32,29 @@ class DuckCryptInfo(Crypter):          if m is None:              self.fail(_("Weird error in link"))          if str(m.group(1)) == "link": -            self.handleLink(url) +            self.handle_link(url)          else: -            self.handleFolder(m) +            self.handle_folder(m) -    def handleFolder(self, m): +    def handle_folder(self, m):          html = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2)))          m = re.match(self.__pattern__, html) -        self.logDebug("Redirectet to " + str(m.group(0))) +        self.log_debug("Redirectet to " + str(m.group(0)))          html = self.load(str(m.group(0))) -        soup = BeautifulSoup(html) -        cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) -        self.logDebug("Redirectet to " + str(cryptlinks)) +        soup = BeautifulSoup.BeautifulSoup(html) +        cryptlinks = soup.findAll("div", attrs={'class': "folderbox"}) +        self.log_debug("Redirectet to " + str(cryptlinks))          if not cryptlinks:              self.error(_("No link found"))          for clink in cryptlinks:              if clink.find("a"): -                self.handleLink(clink.find("a")['href']) +                self.handle_link(clink.find("a")['href']) -    def handleLink(self, url): +    def handle_link(self, url):          html = self.load(url)          soup = BeautifulSoup(html)          self.urls = [soup.find("iframe")['src']]          if not self.urls: -            self.logInfo(_("No link found")) +            self.log_info(_("No link found")) diff --git a/module/plugins/crypter/DuploadOrgFolder.py b/module/plugins/crypter/DuploadOrgFolder.py index d505806b7..f0e9b8c96 100644 --- a/module/plugins/crypter/DuploadOrgFolder.py +++ b/module/plugins/crypter/DuploadOrgFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class DuploadOrgFolder(DeadCrypter):      __name__    = "DuploadOrgFolder"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?dupload\.org/folder/\d+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezComFolder.py index fdd3d4ff4..0c070b6f1 100644 --- a/module/plugins/crypter/EasybytezComFolder.py +++ b/module/plugins/crypter/EasybytezComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo  class EasybytezComFolder(XFSCrypter):      __name__    = "EasybytezComFolder"      __type__    = "crypter" -    __version__ = "0.10" +    __version__ = "0.11" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?easybytez\.com/users/\d+/\d+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 28633f634..341b3e315 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -1,14 +1,15 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  from module.network.HTTPRequest import BadHeader  class EmbeduploadCom(Crypter):      __name__    = "EmbeduploadCom"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"           , True         ), @@ -25,30 +26,30 @@ class EmbeduploadCom(Crypter):      def decrypt(self, pyfile): -        self.html = self.load(pyfile.url, decode=True) +        self.html = self.load(pyfile.url)          tmp_links = []          m = re.findall(self.LINK_PATTERN, self.html)          if m: -            prefered_set = set(self.getConfig('preferedHoster').split('|')) +            prefered_set = set(self.get_config('preferedHoster').split('|'))              prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) -            self.logDebug("PF: %s" % prefered_set) +            self.log_debug("PF: %s" % prefered_set)              tmp_links.extend(x[1] for x in m if x[0] in prefered_set) -            self.urls = self.getLocation(tmp_links) +            self.urls = self.get_location(tmp_links)              if not self.urls: -                ignored_set = set(self.getConfig('ignoredHoster').split('|')) +                ignored_set = set(self.get_config('ignoredHoster').split('|'))                  ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) -                self.logDebug("IG: %s" % ignored_set) +                self.log_debug("IG: %s" % ignored_set)                  tmp_links.extend(x[1] for x in m if x[0] not in ignored_set) -                self.urls = self.getLocation(tmp_links) +                self.urls = self.get_location(tmp_links) -    def getLocation(self, tmp_links): +    def get_location(self, tmp_links):          new_links = []          for link in tmp_links:              try: diff --git a/module/plugins/crypter/FilebeerInfoFolder.py b/module/plugins/crypter/FilebeerInfoFolder.py index 5b401c555..5d0e26329 100644 --- a/module/plugins/crypter/FilebeerInfoFolder.py +++ b/module/plugins/crypter/FilebeerInfoFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class FilebeerInfoFolder(DeadCrypter):      __name__    = "FilebeerInfoFolder"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?filebeer\.info/\d*~f\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/FilecloudIoFolder.py b/module/plugins/crypter/FilecloudIoFolder.py index f900f4910..6c7b5be15 100644 --- a/module/plugins/crypter/FilecloudIoFolder.py +++ b/module/plugins/crypter/FilecloudIoFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FilecloudIoFolder(SimpleCrypter):      __name__    = "FilecloudIoFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 4d2b42f90..9f4ad69aa 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -9,14 +9,15 @@ import urlparse  from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.Crypter import Crypter +from module.plugins.captcha.ReCaptcha import ReCaptcha  class FilecryptCc(Crypter):      __name__    = "FilecryptCc"      __type__    = "crypter" -    __version__ = "0.15" +    __version__ = "0.18" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' @@ -47,66 +48,63 @@ class FilecryptCc(Crypter):          if "content notfound" in self.html:  #@NOTE: "content notfound" is NOT a typo              self.offline() -        self.handlePasswordProtection() -        self.handleCaptcha() -        self.handleMirrorPages() +        self.handle_password_protection() +        self.handle_captcha() +        self.handle_mirror_pages() -        for handle in (self.handleCNL, self.handleWeblinks, self.handleDlcContainer): +        for handle in (self.handle_CNL, self.handle_weblinks, self.handle_dlc_container):              handle()              if self.links:                  self.packages = [(pyfile.package().name, self.links, pyfile.package().name)]                  return -    def handleMirrorPages(self): -        if "mirror=" not in self.siteWithLinks: +    def handle_mirror_pages(self): +        if "mirror=" not in self.site_with_links:              return -        mirror = re.findall(self.MIRROR_PAGE_PATTERN, self.siteWithLinks) +        mirror = re.findall(self.MIRROR_PAGE_PATTERN, self.site_with_links) -        self.logInfo(_("Found %d mirrors") % len(mirror)) +        self.log_info(_("Found %d mirrors") % len(mirror))          for i in mirror[1:]: -            self.siteWithLinks = self.siteWithLinks + self.load(i).decode("utf-8", "replace") +            self.site_with_links = self.site_with_links + self.load(i) -    def handlePasswordProtection(self): +    def handle_password_protection(self):          if '<input type="text" name="password"' not in self.html:              return -        self.logInfo(_("Folder is password protected")) +        self.log_info(_("Folder is password protected")) -        password = self.getPassword() +        password = self.get_password()          if not password:              self.fail(_("Please enter the password in package section and try again")) -        self.html = self.load(self.pyfile.url, post={"password": password}) +        self.html = self.load(self.pyfile.url, post={'password': password}) -    def handleCaptcha(self): +    def handle_captcha(self):          m  = re.search(self.CAPTCHA_PATTERN, self.html)          m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html) -        if m:  #: normal captcha -            self.logDebug("Captcha-URL: %s" % m.group(1)) +        if m:  #: Normal captcha +            self.log_debug("Captcha-URL: %s" % m.group(1)) -            captcha_code = self.decryptCaptcha(urlparse.urljoin(self.base_url, m.group(1)), -                                               forceUser=True, -                                               imgtype="gif") +            captcha_code = self.captcha.decrypt(urlparse.urljoin(self.base_url, m.group(1)), +                                                input_type="gif") -            self.siteWithLinks = self.load(self.pyfile.url, -                                           post={'recaptcha_response_field': captcha_code}, -                                           decode=True) -        elif m2:  #: circle captcha -            self.logDebug("Captcha-URL: %s" % m2.group(1)) +            self.site_with_links = self.load(self.pyfile.url, +                                           post={'recaptcha_response_field': captcha_code}) +        elif m2:  #: Circle captcha +            self.log_debug("Captcha-URL: %s" % m2.group(1)) -            captcha_code = self.decryptCaptcha('%s%s?c=abc' %(self.base_url, m2.group(1)), -                                               result_type='positional') +            captcha_code = self.captcha.decrypt('%s%s?c=abc' %(self.base_url, m2.group(1)), +                                               output_type='positional') -            self.siteWithLinks = self.load(self.pyfile.url, -                                           post={'button.x': captcha_code[0], 'button.y': captcha_code[1]}, -                                           decode=True) +            self.site_with_links = self.load(self.pyfile.url, +                                           post={'button.x': captcha_code[0], 'button.y': captcha_code[1]})          else:              recaptcha   = ReCaptcha(self) @@ -114,20 +112,19 @@ class FilecryptCc(Crypter):              if captcha_key:                  response, challenge = recaptcha.challenge(captcha_key) -                self.siteWithLinks  = self.load(self.pyfile.url, -                                                post={'g-recaptcha-response': response}, -                                                decode=True) +                self.site_with_links  = self.load(self.pyfile.url, +                                                post={'g-recaptcha-response': response})              else: -                self.logInfo(_("No captcha found")) -                self.siteWithLinks = self.html +                self.log_info(_("No captcha found")) +                self.site_with_links = self.html -        if "recaptcha_image" in self.siteWithLinks or "data-sitekey" in self.siteWithLinks: -            self.invalidCaptcha() +        if "recaptcha_image" in self.site_with_links or "data-sitekey" in self.site_with_links: +            self.captcha.invalid()              self.retry() -    def handleDlcContainer(self): -        dlc = re.findall(self.DLC_LINK_PATTERN, self.siteWithLinks) +    def handle_dlc_container(self): +        dlc = re.findall(self.DLC_LINK_PATTERN, self.site_with_links)          if not dlc:              return @@ -136,9 +133,9 @@ class FilecryptCc(Crypter):              self.links.append("%s/DLC/%s.dlc" % (self.base_url, i)) -    def handleWeblinks(self): +    def handle_weblinks(self):          try: -            weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) +            weblinks = re.findall(self.WEBLINK_PATTERN, self.site_with_links)              for link in weblinks:                  res   = self.load("%s/Link/%s.html" % (self.base_url, link)) @@ -147,32 +144,32 @@ class FilecryptCc(Crypter):                  self.links.append(res2['location'])          except Exception, e: -            self.logDebug("Error decrypting weblinks: %s" % e) +            self.log_debug("Error decrypting weblinks: %s" % e) -    def handleCNL(self): +    def handle_CNL(self):          try: -            vjk = re.findall('<input type="hidden" name="jk" value="function f\(\){ return \'(.*)\';}">', self.siteWithLinks) -            vcrypted = re.findall('<input type="hidden" name="crypted" value="(.*)">', self.siteWithLinks) +            vjk = re.findall('<input type="hidden" name="jk" value="function f\(\){ return \'(.*)\';}">', self.site_with_links) +            vcrypted = re.findall('<input type="hidden" name="crypted" value="(.*)">', self.site_with_links)              for i in xrange(len(vcrypted)): -                self.links.extend(self._getLinks(vcrypted[i], vjk[i])) +                self.links.extend(self._get_links(vcrypted[i], vjk[i]))          except Exception, e: -            self.logDebug("Error decrypting CNL: %s" % e) +            self.log_debug("Error decrypting CNL: %s" % e) -    def _getLinks(self, crypted, jk): -        # Get key +    def _get_links(self, crypted, jk): +        #: Get key          key = binascii.unhexlify(str(jk)) -        # Decrypt +        #: Decrypt          Key  = key          IV   = key          obj  = AES.new(Key, AES.MODE_CBC, IV)          text = obj.decrypt(crypted.decode('base64')) -        # Extract links +        #: Extract links          text  = text.replace("\x00", "").replace("\r", "")          links = filter(bool, text.split('\n')) diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index c0cd028cc..aec73f33c 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FilefactoryComFolder(SimpleCrypter):      __name__    = "FilefactoryComFolder"      __type__    = "crypter" -    __version__ = "0.32" +    __version__ = "0.33" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -25,7 +26,7 @@ class FilefactoryComFolder(SimpleCrypter):      PAGES_PATTERN = r'data-paginator-totalPages="(\d+)' -    def loadPage(self, page_n): +    def load_page(self, page_n):          return self.load(self.pyfile.url, get={'page': page_n, 'show': 100}) diff --git a/module/plugins/crypter/FilerNetFolder.py b/module/plugins/crypter/FilerNetFolder.py index e2b44e868..4814c5933 100644 --- a/module/plugins/crypter/FilerNetFolder.py +++ b/module/plugins/crypter/FilerNetFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FilerNetFolder(SimpleCrypter):      __name__    = "FilerNetFolder"      __type__    = "crypter" -    __version__ = "0.42" +    __version__ = "0.43" +    __status__  = "testing"      __pattern__ = r'https?://filer\.net/folder/\w{16}'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/FileserveComFolder.py b/module/plugins/crypter/FileserveComFolder.py index 1363e2d45..44de55581 100644 --- a/module/plugins/crypter/FileserveComFolder.py +++ b/module/plugins/crypter/FileserveComFolder.py @@ -2,13 +2,14 @@  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class FileserveComFolder(Crypter):      __name__    = "FileserveComFolder"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.13" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?fileserve\.com/list/\w+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py index 6cd4d8b8c..7ebba702a 100644 --- a/module/plugins/crypter/FilesonicComFolder.py +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class FilesonicComFolder(DeadCrypter):      __name__    = "FilesonicComFolder"      __type__    = "crypter" -    __version__ = "0.12" +    __version__ = "0.13" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?filesonic\.com/folder/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/FilestubeCom.py b/module/plugins/crypter/FilestubeCom.py index 133f4a53f..5fcd72c64 100644 --- a/module/plugins/crypter/FilestubeCom.py +++ b/module/plugins/crypter/FilestubeCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FilestubeCom(SimpleCrypter):      __name__    = "FilestubeCom"      __type__    = "crypter" -    __version__ = "0.05" +    __version__ = "0.07" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?filestube\.(?:com|to)/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -19,7 +20,7 @@ class FilestubeCom(SimpleCrypter):      LINK_PATTERN = r'<a class=\"file-link-main(?: noref)?\" [^>]* href=\"(http://[^\"]+)' -    NAME_PATTERN = r'<h1\s*> (?P<N>.+)  download\s*</h1>' +    NAME_PATTERN = r'<h1\s*> (?P<N>.+?)  download\s*</h1>'  getInfo = create_getInfo(FilestubeCom) diff --git a/module/plugins/crypter/FiletramCom.py b/module/plugins/crypter/FiletramCom.py index b012d35bc..6603a3542 100644 --- a/module/plugins/crypter/FiletramCom.py +++ b/module/plugins/crypter/FiletramCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FiletramCom(SimpleCrypter):      __name__    = "FiletramCom"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?filetram\.com/[^/]+/.+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/FiredriveComFolder.py b/module/plugins/crypter/FiredriveComFolder.py index 792f3198b..84b6cf34a 100644 --- a/module/plugins/crypter/FiredriveComFolder.py +++ b/module/plugins/crypter/FiredriveComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class FiredriveComFolder(DeadCrypter):      __name__    = "FiredriveComFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/share/.+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py index 366adef14..65a2ac788 100644 --- a/module/plugins/crypter/FourChanOrg.py +++ b/module/plugins/crypter/FourChanOrg.py @@ -5,13 +5,14 @@  import re  import urlparse -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class FourChanOrg(Crypter):      __name__    = "FourChanOrg"      __type__    = "crypter" -    __version__ = "0.31" +    __version__ = "0.33" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareComFolder.py index 173660668..f7f1946f4 100644 --- a/module/plugins/crypter/FreakhareComFolder.py +++ b/module/plugins/crypter/FreakhareComFolder.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FreakhareComFolder(SimpleCrypter):      __name__    = "FreakhareComFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?freakshare\.com/folder/.+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -25,7 +26,7 @@ class FreakhareComFolder(SimpleCrypter):      PAGES_PATTERN = r'Pages: +(\d+)' -    def loadPage(self, page_n): +    def load_page(self, page_n):          if not hasattr(self, 'f_id') and not hasattr(self, 'f_md5'):              m = re.search(r'http://freakshare.com/\?x=folder&f_id=(\d+)&f_md5=(\w+)', self.html)              if m: @@ -36,7 +37,7 @@ class FreakhareComFolder(SimpleCrypter):                                                          'f_md5': self.f_md5,                                                          'entrys': '20',                                                          'page': page_n - 1, -                                                        'order': ''}, decode=True) +                                                        'order': ''})  getInfo = create_getInfo(FreakhareComFolder) diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py index cf6fbb8a4..350f89202 100644 --- a/module/plugins/crypter/FreetexthostCom.py +++ b/module/plugins/crypter/FreetexthostCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FreetexthostCom(SimpleCrypter):      __name__    = "FreetexthostCom"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?freetexthost\.com/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -20,7 +21,7 @@ class FreetexthostCom(SimpleCrypter):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    def getLinks(self): +    def get_links(self):          m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.S)          if m is None:              self.error(_("Unable to extract links")) diff --git a/module/plugins/crypter/FshareVnFolder.py b/module/plugins/crypter/FshareVnFolder.py index bbee53337..f4941007a 100644 --- a/module/plugins/crypter/FshareVnFolder.py +++ b/module/plugins/crypter/FshareVnFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class FshareVnFolder(SimpleCrypter):      __name__    = "FshareVnFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?fshare\.vn/folder/.+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/FurLy.py b/module/plugins/crypter/FurLy.py new file mode 100644 index 000000000..595fcb34d --- /dev/null +++ b/module/plugins/crypter/FurLy.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo + + +class FurLy(SimpleCrypter): +    __name__    = "FurLy" +    __type__    = "crypter" +    __version__ = "0.02" +    __status__  = "testing" + +    __pattern__ = r'http://(?:www\.)?fur\.ly/(\d/)?\w+' + +    __description__ = """Fur.ly decrypter plugin""" +    __license__     = "GPLv3" +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] + + +    URL_REPLACEMENTS = [(r'fur\.ly/', r'fur\.ly/bar/')] + +    LINK_PATTERN    = r'urls\[\d+\] = "(.+?)"' +    OFFLINE_PATTERN = r'var output;\s*var total' + + +getInfo = create_getInfo(FurLy) diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 22f31f6f6..026982014 100644 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class Go4UpCom(SimpleCrypter):      __name__    = "Go4UpCom"      __type__    = "crypter" -    __version__ = "0.12" +    __version__ = "0.13" +    __status__  = "testing"      __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -29,7 +30,7 @@ class Go4UpCom(SimpleCrypter):      OFFLINE_PATTERN = r'>\s*(404 Page Not Found|File not Found|Mirror does not exist)' -    def getLinks(self): +    def get_links(self):          links = []          m = re.search(r'(/download/gethosts/.+?)"', self.html) diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py index 30e193b9d..76a542408 100644 --- a/module/plugins/crypter/GooGl.py +++ b/module/plugins/crypter/GooGl.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  from module.common.json_layer import json_loads -class GooGl(SimpleDereferer): +class GooGl(SimpleCrypter):      __name__    = "GooGl"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?goo\.gl/([a-zA-Z]+/)?\w+' @@ -22,11 +23,11 @@ class GooGl(SimpleDereferer):      OFFLINE_PATTERN = r'has been disabled|does not exist' -    def getLink(self): +    def get_links(self):          rep = self.load(self.API_URL, get={'shortUrl': self.pyfile.url}) -        self.logDebug("JSON data: " + rep) +        self.log_debug("JSON data: " + rep)          rep = json_loads(rep) -        return rep['longUrl'] if "longUrl" in rep else None +        return [rep['longUrl']] if "longUrl" in rep else None  getInfo = create_getInfo(GooGl) diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py index 70898b313..88c7ebab2 100644 --- a/module/plugins/crypter/GoogledriveComFolder.py +++ b/module/plugins/crypter/GoogledriveComFolder.py @@ -6,10 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class GoogledriveComFolder(SimpleCrypter):      __name__    = "GoogledriveCom"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+' -    __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True),  #: Overrides core.config['general']['folder_per_package'] +    __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True),  #: Overrides pyload.config['general']['folder_per_package']                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]      __description__ = """Drive.google.com folder decrypter plugin""" diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index ccc3ab664..27075324d 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -2,15 +2,16 @@  import re -from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup +import BeautifulSoup -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class HoerbuchIn(Crypter):      __name__    = "HoerbuchIn"      __type__    = "crypter" -    __version__ = "0.60" +    __version__ = "0.62" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -31,26 +32,26 @@ class HoerbuchIn(Crypter):          if self.article.match(pyfile.url):              html = self.load(pyfile.url) -            soup = BeautifulSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) +            soup = BeautifulSoup.BeautifulSoup(html, convertEntities=BeautifulSoup.BeautifulStoneSoup.HTML_ENTITIES) -            abookname = soup.find("a", attrs={"rel": "bookmark"}).text -            for a in soup.findAll("a", attrs={"href": self.protection}): +            abookname = soup.find("a", attrs={'rel': "bookmark"}).text +            for a in soup.findAll("a", attrs={'href': self.protection}):                  package = "%s (%s)" % (abookname, a.previousSibling.previousSibling.text[:-1]) -                links = self.decryptFolder(a['href']) +                links = self.decrypt_folder(a['href'])                  self.packages.append((package, links, package))          else: -            self.urls = self.decryptFolder(pyfile.url) +            self.urls = self.decrypt_folder(pyfile.url) -    def decryptFolder(self, url): +    def decrypt_folder(self, url):          m = self.protection.search(url)          if m is None:              self.fail(_("Bad URL"))          url = m.group(0)          self.pyfile.url = url -        html = self.load(url, post={"viewed": "adpg"}) +        html = self.load(url, post={'viewed': "adpg"})          links = []          pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") diff --git a/module/plugins/crypter/HotfileComFolder.py b/module/plugins/crypter/HotfileComFolder.py index f1dd56228..1b2429f4a 100644 --- a/module/plugins/crypter/HotfileComFolder.py +++ b/module/plugins/crypter/HotfileComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class HotfileComFolder(DeadCrypter):      __name__    = "HotfileComFolder"      __type__    = "crypter" -    __version__ = "0.30" +    __version__ = "0.31" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?hotfile\.com/list/\w+/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/ILoadTo.py b/module/plugins/crypter/ILoadTo.py index 4c7387739..03826cc5a 100644 --- a/module/plugins/crypter/ILoadTo.py +++ b/module/plugins/crypter/ILoadTo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class ILoadTo(DeadCrypter):      __name__    = "ILoadTo"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+-[\w.-]+/'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/ImgurComAlbum.py b/module/plugins/crypter/ImgurComAlbum.py index 9ef7797af..488979b48 100644 --- a/module/plugins/crypter/ImgurComAlbum.py +++ b/module/plugins/crypter/ImgurComAlbum.py @@ -7,7 +7,8 @@ from module.utils import uniqify  class ImgurComAlbum(SimpleCrypter):      __name__    = "ImgurComAlbum"      __type__    = "crypter" -    __version__ = "0.51" +    __version__ = "0.52" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -23,7 +24,7 @@ class ImgurComAlbum(SimpleCrypter):      LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' -    def getLinks(self): +    def get_links(self):          f = lambda url: "http://" + re.sub(r'(\w{7})s\.', r'\1.', url)          return uniqify(map(f, re.findall(self.LINK_PATTERN, self.html))) diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNetFolder.py index b60d754a7..e560306f5 100644 --- a/module/plugins/crypter/LetitbitNetFolder.py +++ b/module/plugins/crypter/LetitbitNetFolder.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class LetitbitNetFolder(Crypter):      __name__    = "LetitbitNetFolder"      __type__    = "crypter" -    __version__ = "0.10" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?letitbit\.net/folder/\w+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 5c65e726d..af13f55f6 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -7,14 +7,15 @@ import pycurl  from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  from module.utils import html_unescape  class LinkCryptWs(Crypter):      __name__    = "LinkCryptWs"      __type__    = "crypter" -    __version__ = "0.08" +    __version__ = "0.10" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)' @@ -36,13 +37,13 @@ class LinkCryptWs(Crypter):      def prepare(self): -        # Init +        #: Init          self.fileid = re.match(self.__pattern__, self.pyfile.url).group('ID')          self.req.cj.setCookie("linkcrypt.ws", "language", "en") -        # Request package -        self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko")  #: better chance to not get those key-captchas +        #: Request package +        self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko")  #: Better chance to not get those key-captchas          self.html = self.load(self.pyfile.url) @@ -52,34 +53,34 @@ class LinkCryptWs(Crypter):          self.prepare() -        if not self.isOnline(): +        if not self.is_online():              self.offline() -        if self.isKeyCaptchaProtected(): +        if self.is_key_captcha_protected():              self.retry(8, 15, _("Can't handle Key-Captcha")) -        if self.isCaptchaProtected(): +        if self.is_captcha_protected():              self.captcha = True -            self.unlockCaptchaProtection() -            self.handleCaptchaErrors() +            self.unlock_captcha_protection() +            self.handle_captcha_errors() -        # Check for protection -        if self.isPasswordProtected(): -            self.unlockPasswordProtection() -            self.handleErrors() +        #: Check for protection +        if self.is_password_protected(): +            self.unlock_password_protection() +            self.handle_errors() -        # get unrar password +        #: Get unrar password          self.getunrarpw() -        # Get package name and folder -        package_name, folder_name = self.getPackageInfo() +        #: Get package name and folder +        package_name, folder_name = self.get_package_info() -        #get the container definitions from script section +        #: Get the container definitions from script section          self.get_container_html() -        # Extract package links +        #: Extract package links          for type in self.sources: -            links = self.handleLinkSource(type) +            links = self.handle_link_source(type)              if links:                  self.links.extend(links) @@ -89,59 +90,59 @@ class LinkCryptWs(Crypter):              self.packages = [(package_name, self.links, folder_name)] -    def isOnline(self): +    def is_online(self):          if "<title>Linkcrypt.ws // Error 404</title>" in self.html: -            self.logDebug("Folder doesn't exist anymore") +            self.log_debug("Folder doesn't exist anymore")              return False          else:              return True -    def isPasswordProtected(self): +    def is_password_protected(self):          if "Authorizing" in self.html: -            self.logDebug("Links are password protected") +            self.log_debug("Links are password protected")              return True          else:              return False -    def isCaptchaProtected(self): +    def is_captcha_protected(self):          if 'id="captcha">' in self.html: -            self.logDebug("Links are captcha protected") +            self.log_debug("Links are captcha protected")              return True          else:              return False -    def isKeyCaptchaProtected(self): +    def is_key_captcha_protected(self):          if re.search(r'>If the folder does not open after klick on <', self.html, re.I):              return True          else:              return False -    def unlockPasswordProtection(self): -        password = self.getPassword() +    def unlock_password_protection(self): +        password = self.get_password()          if password: -            self.logDebug("Submitting password [%s] for protected links" % password) -            self.html = self.load(self.pyfile.url, post={"password": password, 'x': "0", 'y': "0"}) +            self.log_debug("Submitting password [%s] for protected links" % password) +            self.html = self.load(self.pyfile.url, post={'password': password, 'x': "0", 'y': "0"})          else:              self.fail(_("Folder is password protected")) -    def unlockCaptchaProtection(self): +    def unlock_captcha_protection(self):          captcha_url  = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="(.+?)"', self.html, re.I | re.S).group(1) -        captcha_code = self.decryptCaptcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional') +        captcha_code = self.captcha.decrypt(captcha_url, input_type="gif", output_type='positional') -        self.html = self.load(self.pyfile.url, post={"x": captcha_code[0], "y": captcha_code[1]}) +        self.html = self.load(self.pyfile.url, post={'x': captcha_code[0], 'y': captcha_code[1]}) -    def getPackageInfo(self): +    def get_package_info(self):          name   = self.pyfile.package().name          folder = self.pyfile.package().folder -        self.logDebug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder)) +        self.log_debug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder))          return name, folder @@ -149,51 +150,51 @@ class LinkCryptWs(Crypter):      def getunrarpw(self):          sitein = self.html          indexi = sitein.find("|source|") + 8 -        indexe = sitein.find("|",indexi) +        indexe = sitein.find("|", indexi)          unrarpw = sitein[indexi:indexe]          if not (unrarpw == "Password" or "Dateipasswort") : -            self.logDebug("File password set to: [%s]"% unrarpw) +            self.log_debug("File password set to: [%s]"% unrarpw)              self.pyfile.package().password = unrarpw -    def handleErrors(self): -        if self.isPasswordProtected(): +    def handle_errors(self): +        if self.is_password_protected():              self.fail(_("Incorrect password")) -    def handleCaptchaErrors(self): +    def handle_captcha_errors(self):          if self.captcha:              if "Your choice was wrong!" in self.html: -                self.invalidCaptcha() +                self.captcha.invalid()                  self.retry()              else: -                self.correctCaptcha() +                self.captcha.correct() -    def handleLinkSource(self, type): -        if type == 'cnl': -                return self.handleCNL2() +    def handle_link_source(self, type): +        if type == "cnl": +                return self.handle_CNL2() -        elif type == 'web': -                return self.handleWebLinks() +        elif type == "web": +                return self.handle_web_links()          elif type in ('rsdf', 'ccf', 'dlc'): -                return self.handleContainer(type) +                return self.handle_container(type)          else:              self.fail(_("Unknown source type: %s") % type)  #@TODO: Replace with self.error in 0.4.10 -    def handleWebLinks(self): -        self.logDebug("Search for Web links ") +    def handle_web_links(self): +        self.log_debug("Search for Web links ")          package_links = []          pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"'          ids = re.findall(pattern, self.html, re.I | re.S) -        self.logDebug("Decrypting %d Web links" % len(ids)) +        self.log_debug("Decrypting %d Web links" % len(ids))          for idx, weblink_id in enumerate(ids):              try: @@ -208,7 +209,7 @@ class LinkCryptWs(Crypter):                  package_links.append(link2)              except Exception, detail: -                self.logDebug("Error decrypting Web link %s, %s" % (weblink_id, detail)) +                self.log_debug("Error decrypting Web link %s, %s" % (weblink_id, detail))          return package_links @@ -228,13 +229,13 @@ class LinkCryptWs(Crypter):          return self.js.eval(line.replace('{}))',"{}).replace('document.open();document.write','').replace(';document.close();',''))")) -    def handleContainer(self, type): +    def handle_container(self, type):          package_links = []          type = type.lower() -        self.logDebug('Search for %s Container links' % type.upper()) +        self.log_debug('Search for %s Container links' % type.upper()) -        if not type.isalnum():  # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) +        if not type.isalnum():  #: Check to prevent broken re-pattern (cnl2, rsdf, ccf, dlc, web are all alpha-numeric)              self.fail(_("Unknown container type: %s") % type)  #@TODO: Replace with self.error in 0.4.10          for line in self.container_html: @@ -245,18 +246,18 @@ class LinkCryptWs(Crypter):                  if not clink:                      continue -                self.logDebug("clink avaible") +                self.log_debug("clink avaible") -                package_name, folder_name = self.getPackageInfo() -                self.logDebug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) -                self.core.api.uploadContainer( "%s.%s" %(package_name, type), self.load(clink.group(1))) +                package_name, folder_name = self.get_package_info() +                self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) +                self.pyload.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1)))                  return "Found it"          return package_links -    def handleCNL2(self): -        self.logDebug("Search for CNL links") +    def handle_CNL2(self): +        self.log_debug("Search for CNL links")          package_links = []          cnl_line = None @@ -267,52 +268,52 @@ class LinkCryptWs(Crypter):                  break          if cnl_line: -            self.logDebug("cnl_line gefunden") +            self.log_debug("cnl_line gefunden")          try:              cnl_section = self.handle_javascript(cnl_line) -            (vcrypted, vjk) = self._getCipherParams(cnl_section) +            (vcrypted, vjk) = self._get_cipher_params(cnl_section)              for (crypted, jk) in zip(vcrypted, vjk): -                package_links.extend(self._getLinks(crypted, jk)) +                package_links.extend(self._get_links(crypted, jk))          except Exception: -            self.logError(_("Unable to decrypt CNL links (JS Error) try to get over links")) -            return self.handleWebLinks() +            self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links")) +            return self.handle_web_links()          return package_links -    def _getCipherParams(self, cnl_section): -        # Get jk +    def _get_cipher_params(self, cnl_section): +        #: Get jk          jk_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkCryptWs.JK_KEY          vjk = re.findall(jk_re, cnl_section) -        # Get crypted +        #: Get crypted          crypted_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkCryptWs.CRYPTED_KEY          vcrypted = re.findall(crypted_re, cnl_section) -        # Log and return -        self.logDebug("Detected %d crypted blocks" % len(vcrypted)) +        #: Log and return +        self.log_debug("Detected %d crypted blocks" % len(vcrypted))          return vcrypted, vjk -    def _getLinks(self, crypted, jk): -        # Get key +    def _get_links(self, crypted, jk): +        #: Get key          jreturn = self.js.eval("%s f()" % jk)          key     = binascii.unhexlify(jreturn) -        self.logDebug("JsEngine returns value [%s]" % jreturn) +        self.log_debug("JsEngine returns value [%s]" % jreturn) -        # Decrypt +        #: Decrypt          Key  = key          IV   = key          obj  = AES.new(Key, AES.MODE_CBC, IV)          text = obj.decrypt(crypted.decode('base64')) -        # Extract links +        #: Extract links          text  = text.replace("\x00", "").replace("\r", "")          links = filter(bool, text.split('\n')) -        # Log and return -        self.logDebug("Package has %d links" % len(links)) +        #: Log and return +        self.log_debug("Package has %d links" % len(links))          return links diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 95652096d..36b545de8 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -1,12 +1,13 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class LinkSaveIn(SimpleDereferer): +class LinkSaveIn(SimpleCrypter):      __name__    = "LinkSaveIn"      __type__    = "crypter" -    __version__ = "2.04" +    __version__ = "2.06" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?linksave\.in/\w+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 0704214d0..d8812dbd5 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -2,13 +2,14 @@  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.MultiCrypter import MultiCrypter -class LinkdecrypterCom(Crypter): +class LinkdecrypterCom(MultiCrypter):      __name__    = "LinkdecrypterCom"      __type__    = "crypter" -    __version__ = "0.29" +    __version__ = "0.32" +    __status__  = "testing"      __pattern__ = r'^unmatchable$'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -27,15 +28,15 @@ class LinkdecrypterCom(Crypter):      def setup(self): -        self.password = self.getPassword() +        self.password = self.get_password()          self.req.setOption("timeout", 300)      def decrypt(self, pyfile):          retries = 5 -        post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} -        self.html = self.load('http://linkdecrypter.com/', post=post_dict, decode=True) +        post_dict = {'link_cache': "on", 'pro_links': pyfile.url, 'modo_links': "text"} +        self.html = self.load('http://linkdecrypter.com/', post=post_dict)          while retries:              m = re.search(self.TEXTAREA_PATTERN, self.html, re.S) @@ -49,21 +50,21 @@ class LinkdecrypterCom(Crypter):                  m = re.search(r"<p><i><b>([^<]+)</b></i></p>", self.html)                  msg = m.group(1) if m else "" -                self.logInfo(_("Captcha protected link"), result_type, msg) +                self.log_info(_("Captcha protected link"), result_type, msg) -                captcha = self.decryptCaptcha(captcha_url, result_type=result_type) +                captcha = self.captcha.decrypt(captcha_url, output_type=result_type)                  if result_type == "positional":                      captcha = "%d|%d" % captcha -                self.html = self.load('http://linkdecrypter.com/', post={"captcha": captcha}, decode=True) +                self.html = self.load('http://linkdecrypter.com/', post={'captcha': captcha})                  retries -= 1              elif self.PASSWORD_PATTERN in self.html:                  if self.password: -                    self.logInfo(_("Password protected link")) -                    self.html = self.load('http://linkdecrypter.com/', post={'password': self.password}, decode=True) +                    self.log_info(_("Password protected link")) +                    self.html = self.load('http://linkdecrypter.com/', post={'password': self.password})                  else:                      self.fail(_("Missing password"))              else:                  retries -= 1 -                self.html = self.load('http://linkdecrypter.com/', decode=True) +                self.html = self.load('http://linkdecrypter.com/') diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 5c77eae5e..2d26564e8 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -3,13 +3,14 @@  import re  import urlparse -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class LixIn(Crypter):      __name__    = "LixIn"      __type__    = "crypter" -    __version__ = "0.22" +    __version__ = "0.24" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?lix\.in/(?P<ID>.+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -33,9 +34,9 @@ class LixIn(Crypter):              self.error(_("Unable to identify file ID"))          id = m.group('ID') -        self.logDebug("File id is %s" % id) +        self.log_debug("File id is %s" % id) -        self.html = self.load(url, decode=True) +        self.html = self.load(url)          m = re.search(self.SUBMIT_PATTERN, self.html)          if m is None: @@ -46,18 +47,18 @@ class LixIn(Crypter):              for _i in xrange(5):                  m = re.search(self.CAPTCHA_PATTERN, self.html)                  if m: -                    self.logDebug("Trying captcha") -                    captcharesult = self.decryptCaptcha(urlparse.urljoin("http://lix.in/", m.group(1))) -                self.html = self.load(url, decode=True, -                                          post={"capt": captcharesult, "submit": "submit", "tiny": id}) +                    self.log_debug("Trying captcha") +                    captcharesult = self.captcha.decrypt(urlparse.urljoin("http://lix.in/", m.group(1))) +                self.html = self.load(url, +                                          post={'capt': captcharesult, 'submit': "submit", 'tiny': id})              else: -                self.logDebug("No captcha/captcha solved") +                self.log_debug("No captcha/captcha solved")          else: -            self.html = self.load(url, decode=True, post={"submit": "submit", "tiny": id}) +            self.html = self.load(url, post={'submit': "submit", 'tiny': id})          m = re.search(self.LINK_PATTERN, self.html)          if m is None:              self.error(_("Unable to find destination url"))          else:              self.urls = [m.group(1)] -            self.logDebug("Found link %s, adding to package" % self.urls[0]) +            self.log_debug("Found link %s, adding to package" % self.urls[0]) diff --git a/module/plugins/crypter/LofCc.py b/module/plugins/crypter/LofCc.py index 62e05f299..b25c9485a 100644 --- a/module/plugins/crypter/LofCc.py +++ b/module/plugins/crypter/LofCc.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class LofCc(DeadCrypter):      __name__    = "LofCc"      __type__    = "crypter" -    __version__ = "0.21" +    __version__ = "0.22" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?lof\.cc/(.+)'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/MBLinkInfo.py b/module/plugins/crypter/MBLinkInfo.py index 7ff400f7e..98c63b9d4 100644 --- a/module/plugins/crypter/MBLinkInfo.py +++ b/module/plugins/crypter/MBLinkInfo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class MBLinkInfo(DeadCrypter):      __name__    = "MBLinkInfo"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?mblink\.info/?\?id=(\d+)'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index c1612bb6a..81d880725 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -1,7 +1,7 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  from module.plugins.hoster.MediafireCom import checkHTMLHeader  from module.common.json_layer import json_loads @@ -9,7 +9,8 @@ from module.common.json_layer import json_loads  class MediafireComFolder(Crypter):      __name__    = "MediafireComFolder"      __type__    = "crypter" -    __version__ = "0.14" +    __version__ = "0.16" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -26,27 +27,27 @@ class MediafireComFolder(Crypter):      def decrypt(self, pyfile):          url, result = checkHTMLHeader(pyfile.url) -        self.logDebug("Location (%d): %s" % (result, url)) +        self.log_debug("Location (%d): %s" % (result, url))          if result == 0: -            # load and parse html +            #: Load and parse html              html = self.load(pyfile.url)              m = re.search(self.LINK_PATTERN, html)              if m: -                # file page +                #: File page                  self.urls.append("http://www.mediafire.com/file/%s" % m.group(1))              else: -                # folder page +                #: Folder page                  m = re.search(self.FOLDER_KEY_PATTERN, html)                  if m:                      folder_key = m.group(1) -                    self.logDebug("FOLDER KEY: %s" % folder_key) +                    self.log_debug("FOLDER KEY: %s" % folder_key)                      json_resp = json_loads(self.load("http://www.mediafire.com/api/folder/get_info.php",                                                       get={'folder_key'     : folder_key,                                                            'response_format': "json",                                                            'version'        : 1})) -                    #self.logInfo(json_resp) +                    # self.log_info(json_resp)                      if json_resp['response']['result'] == "Success":                          for link in json_resp['response']['folder_info']['files']:                              self.urls.append("http://www.mediafire.com/file/%s" % link['quickkey']) diff --git a/module/plugins/crypter/MegaCoNzFolder.py b/module/plugins/crypter/MegaCoNzFolder.py index bd135ac5f..107746819 100644 --- a/module/plugins/crypter/MegaCoNzFolder.py +++ b/module/plugins/crypter/MegaCoNzFolder.py @@ -2,15 +2,16 @@  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class MegaCoNzFolder(Crypter):      __name__    = "MegaCoNzFolder"      __type__    = "crypter" -    __version__ = "0.04" +    __version__ = "0.06" +    __status__  = "testing" -    __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' +    __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True),                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] @@ -26,7 +27,4 @@ class MegaCoNzFolder(Crypter):      def decrypt(self, pyfile):          url       = "https://mega.co.nz/#F!%s!%s" % re.match(self.__pattern__, pyfile.url).groups()          self.html = self.load("http://rapidgen.org/linkfinder", post={'linklisturl': url}) -        self.urls = re.findall(r'(https://mega.co.nz/#N!.+?)<', self.html) - -        if not self.urls:  #@TODO: Remove in 0.4.10 -            self.fail(_("No link grabbed")) +        self.urls = re.findall(r'(https://mega(\.co)?\.nz/#N!.+?)<', self.html) diff --git a/module/plugins/crypter/MegaRapidCzFolder.py b/module/plugins/crypter/MegaRapidCzFolder.py index fadd6dbed..8e7bcdf6b 100644 --- a/module/plugins/crypter/MegaRapidCzFolder.py +++ b/module/plugins/crypter/MegaRapidCzFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class MegaRapidCzFolder(SimpleCrypter):      __name__    = "MegaRapidCzFolder"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/slozka/\d+/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadComFolder.py index 60e4af57e..c0ae6d16a 100644 --- a/module/plugins/crypter/MegauploadComFolder.py +++ b/module/plugins/crypter/MegauploadComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class MegauploadComFolder(DeadCrypter):      __name__    = "MegauploadComFolder"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?megaupload\.com/(\?f|xml/folderfiles\.php\?.*&?folderid)=\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/Movie2KTo.py b/module/plugins/crypter/Movie2KTo.py index 919d77c86..53636cda3 100644 --- a/module/plugins/crypter/Movie2KTo.py +++ b/module/plugins/crypter/Movie2KTo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class Movie2KTo(DeadCrypter):      __name__    = "Movie2KTo"      __type__    = "crypter" -    __version__ = "0.51" +    __version__ = "0.52" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?movie2k\.to/(.+)\.html'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index b676c3029..b4326b679 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class MultiUpOrg(SimpleCrypter):      __name__    = "MultiUpOrg"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -24,7 +25,7 @@ class MultiUpOrg(SimpleCrypter):      NAME_PATTERN = r'<title>.*(?:Project|Projet|ownload|élécharger) (?P<N>.+?) (\(|- )' -    def getLinks(self): +    def get_links(self):          m_type = re.match(self.__pattern__, self.pyfile.url).group('TYPE')          if m_type == "project": diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index eea689a09..d9b6236be 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class MultiloadCz(Crypter):      __name__    = "MultiloadCz"      __type__    = "crypter" -    __version__ = "0.40" +    __version__ = "0.42" +    __status__  = "testing"      __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"           , True), @@ -25,7 +26,7 @@ class MultiloadCz(Crypter):      def decrypt(self, pyfile): -        self.html = self.load(pyfile.url, decode=True) +        self.html = self.load(pyfile.url)          if re.match(self.__pattern__, pyfile.url).group(1) == "slozka":              m = re.search(self.FOLDER_PATTERN, self.html) @@ -34,9 +35,9 @@ class MultiloadCz(Crypter):          else:              m = re.findall(self.LINK_PATTERN, self.html)              if m: -                prefered_set = set(self.getConfig('usedHoster').split('|')) +                prefered_set = set(self.get_config('usedHoster').split('|'))                  self.urls.extend(x[1] for x in m if x[0] in prefered_set)                  if not self.urls: -                    ignored_set = set(self.getConfig('ignoredHoster').split('|')) +                    ignored_set = set(self.get_config('ignoredHoster').split('|'))                      self.urls.extend(x[1] for x in m if x[0] not in ignored_set) diff --git a/module/plugins/crypter/MultiuploadCom.py b/module/plugins/crypter/MultiuploadCom.py index 41794445a..358758b7a 100644 --- a/module/plugins/crypter/MultiuploadCom.py +++ b/module/plugins/crypter/MultiuploadCom.py @@ -6,12 +6,13 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class MultiuploadCom(DeadCrypter):      __name__    = "MultiuploadCom"      __type__    = "crypter" -    __version__ = "0.02" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 -    __description__ = """ MultiUpload.com decrypter plugin """ +    __description__ = """MultiUpload.com decrypter plugin"""      __license__     = "GPLv3"      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 593e9b506..d483be323 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -5,14 +5,15 @@ import re  from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.Crypter import Crypter +from module.plugins.captcha.ReCaptcha import ReCaptcha  class NCryptIn(Crypter):      __name__    = "NCryptIn"      __type__    = "crypter" -    __version__ = "1.35" +    __version__ = "1.37" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<TYPE>folder|link|frame)-([^/\?]+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -32,62 +33,62 @@ class NCryptIn(Crypter):      def setup(self):          self.package = None -        self.cleanedHtml = None +        self.cleaned_html = None          self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"]          self.protection_type = None      def decrypt(self, pyfile): -        # Init +        #: Init          self.package = pyfile.package()          package_links = []          package_name = self.package.name          folder_name = self.package.folder -        # Deal with single links -        if self.isSingleLink(): -            package_links.extend(self.handleSingleLink()) +        #: Deal with single links +        if self.is_single_link(): +            package_links.extend(self.handle_single_link()) -        # Deal with folders +        #: Deal with folders          else: -            # Request folder home -            self.html = self.requestFolderHome() -            self.cleanedHtml = self.removeHtmlCrap(self.html) -            if not self.isOnline(): +            #: Request folder home +            self.html = self.request_folder_home() +            self.cleaned_html = self.remove_html_crap(self.html) +            if not self.is_online():                  self.offline() -            # Check for folder protection -            if self.isProtected(): -                self.html = self.unlockProtection() -                self.cleanedHtml = self.removeHtmlCrap(self.html) -                self.handleErrors() +            #: Check for folder protection +            if self.is_protected(): +                self.html = self.unlock_protection() +                self.cleaned_html = self.remove_html_crap(self.html) +                self.handle_errors() -            # Prepare package name and folder -            (package_name, folder_name) = self.getPackageInfo() +            #: Prepare package name and folder +            (package_name, folder_name) = self.get_package_info() -            # Extract package links +            #: Extract package links              for link_source_type in self.links_source_order: -                package_links.extend(self.handleLinkSource(link_source_type)) -                if package_links:  # use only first source which provides links +                package_links.extend(self.handle_link_source(link_source_type)) +                if package_links:  #: Use only first source which provides links                      break              package_links = set(package_links) -        # Pack and return links +        #: Pack and return links          if package_links:              self.packages = [(package_name, package_links, folder_name)] -    def isSingleLink(self): +    def is_single_link(self):          link_type = re.match(self.__pattern__, self.pyfile.url).group('TYPE')          return link_type in ("link", "frame") -    def requestFolderHome(self): -        return self.load(self.pyfile.url, decode=True) +    def request_folder_home(self): +        return self.load(self.pyfile.url) -    def removeHtmlCrap(self, content): +    def remove_html_crap(self, content):          patterns = (r'(type="hidden".*?(name=".*?")?.*?value=".*?")',                      r'display:none;">(.*?)</(div|span)>',                      r'<div\s+class="jdownloader"(.*?)</div>', @@ -99,148 +100,148 @@ class NCryptIn(Crypter):          return content -    def isOnline(self): -        if "Your folder does not exist" in self.cleanedHtml: -            self.logDebug("File not m") +    def is_online(self): +        if "Your folder does not exist" in self.cleaned_html: +            self.log_debug("File not m")              return False          return True -    def isProtected(self): -        form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.S) +    def is_protected(self): +        form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleaned_html, re.S)          if form:              content = form.group(1)              for keyword in ("password", "captcha"):                  if keyword in content:                      self.protection_type = keyword -                    self.logDebug("Links are %s protected" % self.protection_type) +                    self.log_debug("Links are %s protected" % self.protection_type)                      return True          return False -    def getPackageInfo(self): +    def get_package_info(self):          m = re.search(self.NAME_PATTERN, self.html)          if m:              name = folder = m.group('N').strip() -            self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) +            self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder))          else:              name = self.package.name              folder = self.package.folder -            self.logDebug("Package info not m, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) +            self.log_debug("Package info not m, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))          return name, folder -    def unlockProtection(self): +    def unlock_protection(self):          postData = {} -        form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.S).group(1) +        form = re.search(r'<form name="protected"(.*?)</form>', self.cleaned_html, re.S).group(1) -        # Submit package password +        #: Submit package password          if "password" in form: -            password = self.getPassword() -            self.logDebug("Submitting password [%s] for protected links" % password) +            password = self.get_password() +            self.log_debug("Submitting password [%s] for protected links" % password)              postData['password'] = password -        # Resolve anicaptcha +        #: Resolve anicaptcha          if "anicaptcha" in form: -            self.logDebug("Captcha protected") +            self.log_debug("Captcha protected")              captchaUri = re.search(r'src="(/temp/anicaptcha/.+?)"', form).group(1) -            captcha = self.decryptCaptcha("http://ncrypt.in" + captchaUri) -            self.logDebug("Captcha resolved [%s]" % captcha) +            captcha = self.captcha.decrypt("http://ncrypt.in" + captchaUri) +            self.log_debug("Captcha resolved [%s]" % captcha)              postData['captcha'] = captcha -        # Resolve recaptcha +        #: Resolve recaptcha          if "recaptcha" in form: -            self.logDebug("ReCaptcha protected") +            self.log_debug("ReCaptcha protected")              captcha_key = re.search(r'\?k=(.*?)"', form).group(1) -            self.logDebug("Resolving ReCaptcha with key [%s]" % captcha_key) +            self.log_debug("Resolving ReCaptcha with key [%s]" % captcha_key)              recaptcha = ReCaptcha(self)              response, challenge = recaptcha.challenge(captcha_key)              postData['recaptcha_challenge_field'] = challenge              postData['recaptcha_response_field']  = response -        # Resolve circlecaptcha +        #: Resolve circlecaptcha          if "circlecaptcha" in form: -            self.logDebug("CircleCaptcha protected") +            self.log_debug("CircleCaptcha protected")              captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" -            coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') -            self.logDebug("Captcha resolved, coords [%s]" % str(coords)) +            coords = self.captcha.decrypt(captcha_img_url, input_type="png", output_type='positional', ocr="CircleCaptcha") +            self.log_debug("Captcha resolved, coords [%s]" % str(coords))              postData['circle.x'] = coords[0]              postData['circle.y'] = coords[1] -        # Unlock protection +        #: Unlock protection          postData['submit_protected'] = 'Continue to folder' -        return self.load(self.pyfile.url, post=postData, decode=True) +        return self.load(self.pyfile.url, post=postData) -    def handleErrors(self): +    def handle_errors(self):          if self.protection_type == "password": -            if "This password is invalid!" in self.cleanedHtml: -                self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") +            if "This password is invalid!" in self.cleaned_html: +                self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry")                  self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry"))          if self.protection_type == "captcha": -            if "The securitycheck was wrong!" in self.cleanedHtml: -                self.invalidCaptcha() +            if "The securitycheck was wrong!" in self.cleaned_html: +                self.captcha.invalid()                  self.retry()              else: -                self.correctCaptcha() +                self.captcha.correct() -    def handleLinkSource(self, link_source_type): -        # Check for JS engine +    def handle_link_source(self, link_source_type): +        #: Check for JS engine          require_js_engine = link_source_type in ("cnl2", "rsdf", "ccf", "dlc")          if require_js_engine and not self.js: -            self.logDebug("No JS engine available, skip %s links" % link_source_type) +            self.log_debug("No JS engine available, skip %s links" % link_source_type)              return [] -        # Select suitable handler -        if link_source_type == 'single': -            return self.handleSingleLink() -        if link_source_type == 'cnl2': -            return self.handleCNL2() +        #: Select suitable handler +        if link_source_type == "single": +            return self.handle_single_link() +        if link_source_type == "cnl2": +            return self.handle_CNL2()          elif link_source_type in ("rsdf", "ccf", "dlc"): -            return self.handleContainer(link_source_type) +            return self.handle_container(link_source_type)          elif link_source_type == "web": -            return self.handleWebLinks() +            return self.handle_web_links()          else:              self.error(_('Unknown source type "%s"') % link_source_type) -    def handleSingleLink(self): -        self.logDebug("Handling Single link") +    def handle_single_link(self): +        self.log_debug("Handling Single link")          package_links = [] -        # Decrypt single link -        decrypted_link = self.decryptLink(self.pyfile.url) +        #: Decrypt single link +        decrypted_link = self.decrypt_link(self.pyfile.url)          if decrypted_link:              package_links.append(decrypted_link)          return package_links -    def handleCNL2(self): -        self.logDebug("Handling CNL2 links") +    def handle_CNL2(self): +        self.log_debug("Handling CNL2 links")          package_links = [] -        if 'cnl2_output' in self.cleanedHtml: +        if 'cnl2_output' in self.cleaned_html:              try: -                (vcrypted, vjk) = self._getCipherParams() +                (vcrypted, vjk) = self._get_cipher_params()                  for (crypted, jk) in zip(vcrypted, vjk): -                    package_links.extend(self._getLinks(crypted, jk)) +                    package_links.extend(self._get_links(crypted, jk))              except Exception:                  self.fail(_("Unable to decrypt CNL2 links"))          return package_links -    def handleContainers(self): -        self.logDebug("Handling Container links") +    def handle_containers(self): +        self.log_debug("Handling Container links")          package_links = []          pattern = r'/container/(rsdf|dlc|ccf)/(\w+)'          containersLinks = re.findall(pattern, self.html) -        self.logDebug("Decrypting %d Container links" % len(containersLinks)) +        self.log_debug("Decrypting %d Container links" % len(containersLinks))          for containerLink in containersLinks:              link = "http://ncrypt.in/container/%s/%s.%s" % (containerLink[0], containerLink[1], containerLink[0])              package_links.append(link) @@ -248,15 +249,15 @@ class NCryptIn(Crypter):          return package_links -    def handleWebLinks(self): -        self.logDebug("Handling Web links") +    def handle_web_links(self): +        self.log_debug("Handling Web links")          pattern = r'(http://ncrypt\.in/link-.*?=)'          links = re.findall(pattern, self.html)          package_links = [] -        self.logDebug("Decrypting %d Web links" % len(links)) +        self.log_debug("Decrypting %d Web links" % len(links))          for i, link in enumerate(links): -            self.logDebug("Decrypting Web link %d, %s" % (i + 1, link)) +            self.log_debug("Decrypting Web link %d, %s" % (i + 1, link))              decrypted_link = self.decrypt(link)              if decrypted_link:                  package_links.append(decrypted_link) @@ -264,47 +265,47 @@ class NCryptIn(Crypter):          return package_links -    def decryptLink(self, link): +    def decrypt_link(self, link):          try:              url = link.replace("link-", "frame-")              link = self.load(url, just_header=True)['location']              return link          except Exception, detail: -            self.logDebug("Error decrypting link %s, %s" % (link, detail)) +            self.log_debug("Error decrypting link %s, %s" % (link, detail)) -    def _getCipherParams(self): +    def _get_cipher_params(self):          pattern = r'<input.*?name="%s".*?value="(.*?)"' -        # Get jk +        #: Get jk          jk_re = pattern % NCryptIn.JK_KEY          vjk = re.findall(jk_re, self.html) -        # Get crypted +        #: Get crypted          crypted_re = pattern % NCryptIn.CRYPTED_KEY          vcrypted = re.findall(crypted_re, self.html) -        # Log and return -        self.logDebug("Detected %d crypted blocks" % len(vcrypted)) +        #: Log and return +        self.log_debug("Detected %d crypted blocks" % len(vcrypted))          return vcrypted, vjk -    def _getLinks(self, crypted, jk): -        # Get key +    def _get_links(self, crypted, jk): +        #: Get key          jreturn = self.js.eval("%s f()" % jk) -        self.logDebug("JsEngine returns value [%s]" % jreturn) +        self.log_debug("JsEngine returns value [%s]" % jreturn)          key = binascii.unhexlify(jreturn) -        # Decrypt +        #: Decrypt          Key = key          IV = key          obj = AES.new(Key, AES.MODE_CBC, IV)          text = obj.decrypt(crypted.decode('base64')) -        # Extract links +        #: Extract links          text = text.replace("\x00", "").replace("\r", "")          links = filter(bool, text.split('\n')) -        # Log and return -        self.logDebug("Block has %d links" % len(links)) +        #: Log and return +        self.log_debug("Block has %d links" % len(links))          return links diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index 32d59af03..5b992bf58 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class NetfolderIn(DeadCrypter):      __name__    = "NetfolderIn"      __type__    = "crypter" -    __version__ = "0.73" +    __version__ = "0.74" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?netfolder\.(in|me)/(folder\.php\?folder_id=)?(?P<ID>\w+)(?(1)|/\w+)'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/NitroflareComFolder.py b/module/plugins/crypter/NitroflareComFolder.py new file mode 100644 index 000000000..0f0443355 --- /dev/null +++ b/module/plugins/crypter/NitroflareComFolder.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo + + +class NitroflareComFolder(SimpleCrypter): +    __name__    = "NitroflareComFolder" +    __type__    = "crypter" +    __version__ = "0.03" +    __status__  = "testing" + +    __pattern__ = r'https?://(?:www\.)?nitroflare\.com/folder/(?P<USER>\d+)/(?P<ID>[\w=]+)' +    __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), +                   ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + +    __description__ = """Nitroflare.com folder decrypter plugin""" +    __license__     = "GPLv3" +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] + + +    def get_links(self): +        res = json_loads(self.load("http://nitroflare.com/ajax/folder.php", +                                   post={'userId' : self.info['pattern']['USER'], +                                         'folder' : self.info['pattern']['ID'], +                                         'page'   : 1, +                                         'perPage': 10000})) +        if res['name']: +            self.pyfile.name = res['name'] +        else: +            self.offline() + +        return [link['url'] for link in res['files']] if 'files' in res else None + + +getInfo = create_getInfo(NitroflareComFolder) diff --git a/module/plugins/crypter/NosvideoCom.py b/module/plugins/crypter/NosvideoCom.py index 9808837c4..4513440d6 100644 --- a/module/plugins/crypter/NosvideoCom.py +++ b/module/plugins/crypter/NosvideoCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class NosvideoCom(SimpleCrypter):      __name__    = "NosvideoCom"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?nosvideo\.com/\?v=\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), diff --git a/module/plugins/crypter/OneKhDe.py b/module/plugins/crypter/OneKhDe.py index 4dcb416f5..341359c5a 100644 --- a/module/plugins/crypter/OneKhDe.py +++ b/module/plugins/crypter/OneKhDe.py @@ -2,15 +2,15 @@  import re -from module.unescape import unescape - -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter +from module.utils import html_unescape  class OneKhDe(Crypter):      __name__    = "OneKhDe"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.13" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?1kh\.de/f/'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -27,7 +27,8 @@ class OneKhDe(Crypter):      def file_exists(self): -        """ returns True or False +        """ +        Returns True or False          """          return True @@ -37,6 +38,6 @@ class OneKhDe(Crypter):          self.html = self.load(url)          link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html)          for id in link_ids: -            new_link = unescape( +            new_link = html_unescape(                  re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.load("http://1kh.de/l/" + id)).group(1))              self.urls.append(new_link) diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronComFolder.py index 048af7d82..563c984fc 100644 --- a/module/plugins/crypter/OronComFolder.py +++ b/module/plugins/crypter/OronComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class OronComFolder(DeadCrypter):      __name__    = "OronComFolder"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?oron\.com/folder/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/PastebinCom.py b/module/plugins/crypter/PastebinCom.py index 751b47cc9..c8a7473f1 100644 --- a/module/plugins/crypter/PastebinCom.py +++ b/module/plugins/crypter/PastebinCom.py @@ -6,9 +6,10 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class PastebinCom(SimpleCrypter):      __name__    = "PastebinCom"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.05" +    __status__  = "testing" -    __pattern__ = r'http://(?:www\.)?pastebin\.com/\w+' +    __pattern__ = r'https://(?:www\.)?pastebin\.com/(.+i=)?(?P<ID>\w{8})'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True),                     ("use_subfolder"     , "bool", "Save package to subfolder"          , True),                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] @@ -18,8 +19,10 @@ class PastebinCom(SimpleCrypter):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    LINK_PATTERN = r'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>' -    NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>.+?)">' +    URL_REPLACEMENTS = [(__pattern__ + '.*', r'http://www.pastebin.com/\g<ID>')] + +    NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>.+?)"' +    LINK_PATTERN = r'<div class="de\d+">(.+?)<'  getInfo = create_getInfo(PastebinCom) diff --git a/module/plugins/crypter/PastedCo.py b/module/plugins/crypter/PastedCo.py new file mode 100644 index 000000000..0804f56d4 --- /dev/null +++ b/module/plugins/crypter/PastedCo.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.Crypter import Crypter + +import re + + +class PastedCo(Crypter): +    __name__    = "PastedCo" +    __type__    = "crypter" +    __version__ = "0.02" +    __status__  = "testing" + +    __pattern__ = r'http://pasted\.co/\w+' + +    __description__ = """Pasted.co decrypter plugin""" +    __license__     = "GPLv3" +    __authors__     = [("Frederik Möllers", "fred-public@posteo.de")] + + +    NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>' +    NAME_PATTERN = r"'save_paste' href=\"(http://pasted.co/[0-9a-f]+)/info" + +    FS_URL_PREFIX = '<pre id=\'thepaste\' class="prettyprint">' +    FS_URL_SUFFIX = '</pre>' + +    def decrypt(self, pyfile): +        package = pyfile.package() +        package_name = package.name +        package_folder = package.folder +        html = self.load(pyfile.url, decode = True).splitlines() +        fs_url = None +        FS_URL_RE = re.compile('%s/fullscreen\.php\?hash=[0-9a-f]*' % pyfile.url) +        for line in html: +            match = FS_URL_RE.search(line) +            if match: +                fs_url = match.group() +                break +        if not fs_url: +            raise Exception("Could not find pasted.co fullscreen URL!") +        urls = self.load(fs_url, decode = True) +        urls = urls[urls.find(PastedCo.FS_URL_PREFIX) + len(PastedCo.FS_URL_PREFIX):] +        urls = urls[:urls.find(PastedCo.FS_URL_SUFFIX)].splitlines() +        self.packages.append((package_name, urls, package_folder)) diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCzFolder.py index 3e38d36b4..10b6073e4 100644 --- a/module/plugins/crypter/QuickshareCzFolder.py +++ b/module/plugins/crypter/QuickshareCzFolder.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class QuickshareCzFolder(Crypter):      __name__    = "QuickshareCzFolder"      __type__    = "crypter" -    __version__ = "0.10" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?quickshare\.cz/slozka-\d+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/RSLayerCom.py b/module/plugins/crypter/RSLayerCom.py index 6f078e9e4..c8637279b 100644 --- a/module/plugins/crypter/RSLayerCom.py +++ b/module/plugins/crypter/RSLayerCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class RSLayerCom(DeadCrypter):      __name__    = "RSLayerCom"      __type__    = "crypter" -    __version__ = "0.21" +    __version__ = "0.22" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?rs-layer\.com/directory-'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index ed3da1f9b..b3c13db5d 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -7,14 +7,15 @@ import re  import os  from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.utils import save_join +from module.plugins.internal.Crypter import Crypter +from module.utils import save_join as fs_join  class RelinkUs(Crypter):      __name__    = "RelinkUs"      __type__    = "crypter" -    __version__ = "3.12" +    __version__ = "3.14" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<ID>.+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -62,164 +63,164 @@ class RelinkUs(Crypter):      def decrypt(self, pyfile): -        # Init -        self.initPackage(pyfile) +        #: Init +        self.init_package(pyfile) -        # Request package -        self.requestPackage() +        #: Request package +        self.request_package() -        # Check for online -        if not self.isOnline(): +        #: Check for online +        if not self.is_online():              self.offline() -        # Check for protection -        if self.isPasswordProtected(): -            self.unlockPasswordProtection() -            self.handleErrors() +        #: Check for protection +        if self.is_password_protected(): +            self.unlock_password_protection() +            self.handle_errors() -        if self.isCaptchaProtected(): +        if self.is_captcha_protected():              self.captcha = True -            self.unlockCaptchaProtection() -            self.handleErrors() +            self.unlock_captcha_protection() +            self.handle_errors() -        # Get package name and folder -        (package_name, folder_name) = self.getPackageInfo() +        #: Get package name and folder +        (package_name, folder_name) = self.get_package_info() -        # Extract package links +        #: Extract package links          package_links = []          for sources in self.PREFERRED_LINK_SOURCES: -            package_links.extend(self.handleLinkSource(sources)) -            if package_links:  # use only first source which provides links +            package_links.extend(self.handle_link_source(sources)) +            if package_links:  #: Use only first source which provides links                  break          package_links = set(package_links) -        # Pack +        #: Pack          if package_links:              self.packages = [(package_name, package_links, folder_name)] -    def initPackage(self, pyfile): +    def init_package(self, pyfile):          self.fileid = re.match(self.__pattern__, pyfile.url).group('ID')          self.package = pyfile.package() -    def requestPackage(self): -        self.html = self.load(self.pyfile.url, decode=True) +    def request_package(self): +        self.html = self.load(self.pyfile.url) -    def isOnline(self): +    def is_online(self):          if self.OFFLINE_TOKEN in self.html: -            self.logDebug("File not found") +            self.log_debug("File not found")              return False          return True -    def isPasswordProtected(self): +    def is_password_protected(self):          if self.PASSWORD_TOKEN in self.html: -            self.logDebug("Links are password protected") +            self.log_debug("Links are password protected")              return True -    def isCaptchaProtected(self): +    def is_captcha_protected(self):          if self.CAPTCHA_TOKEN in self.html: -            self.logDebug("Links are captcha protected") +            self.log_debug("Links are captcha protected")              return True          return False -    def unlockPasswordProtection(self): -        password = self.getPassword() +    def unlock_password_protection(self): +        password = self.get_password() -        self.logDebug("Submitting password [%s] for protected links" % password) +        self.log_debug("Submitting password [%s] for protected links" % password)          if password:              passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid              passwd_data = {'id': self.fileid, 'password': password, 'pw': 'submit'} -            self.html = self.load(passwd_url, post=passwd_data, decode=True) +            self.html = self.load(passwd_url, post=passwd_data) -    def unlockCaptchaProtection(self): -        self.logDebug("Request user positional captcha resolving") +    def unlock_captcha_protection(self): +        self.log_debug("Request user positional captcha resolving")          captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid -        coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') -        self.logDebug("Captcha resolved, coords [%s]" % str(coords)) +        coords = self.captcha.decrypt(captcha_img_url, input_type="png", output_type='positional', ocr="CircleCaptcha") +        self.log_debug("Captcha resolved, coords [%s]" % str(coords))          captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid          captcha_post_data = {'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit'} -        self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True) +        self.html = self.load(captcha_post_url, post=captcha_post_data) -    def getPackageInfo(self): +    def get_package_info(self):          name = folder = None -        # Try to get info from web +        #: Try to get info from web          m = re.search(self.FILE_TITLE_REGEX, self.html)          if m:              title = m.group(1).strip()              if not self.FILE_NOTITLE in title:                  name = folder = title -                self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) +                self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder)) -        # Fallback to defaults +        #: Fallback to defaults          if not name or not folder:              name = self.package.name              folder = self.package.folder -            self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) +            self.log_debug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) -        # Return package info +        #: Return package info          return name, folder -    def handleErrors(self): +    def handle_errors(self):          if self.PASSWORD_ERROR_ROKEN in self.html:              msg = "Incorrect password, please set right password on 'Edit package' form and retry" -            self.logDebug(msg) +            self.log_debug(msg)              self.fail(_(msg))          if self.captcha:              if self.CAPTCHA_ERROR_ROKEN in self.html: -                self.invalidCaptcha() +                self.captcha.invalid()                  self.retry()              else: -                self.correctCaptcha() +                self.captcha.correct() -    def handleLinkSource(self, source): -        if source == 'cnl2': -            return self.handleCNL2Links() -        elif source == 'dlc': -            return self.handleDLCLinks() -        elif source == 'web': -            return self.handleWEBLinks() +    def handle_link_source(self, source): +        if source == "cnl2": +            return self.handle_CNL2Links() +        elif source == "dlc": +            return self.handle_DLC_links() +        elif source == "web": +            return self.handle_WEB_links()          else:              self.error(_('Unknown source type "%s"') % source) -    def handleCNL2Links(self): -        self.logDebug("Search for CNL2 links") +    def handle_CNL2Links(self): +        self.log_debug("Search for CNL2 links")          package_links = []          m = re.search(self.CNL2_FORM_REGEX, self.html, re.S)          if m:              cnl2_form = m.group(1)              try: -                (vcrypted, vjk) = self._getCipherParams(cnl2_form) +                (vcrypted, vjk) = self._get_cipher_params(cnl2_form)                  for (crypted, jk) in zip(vcrypted, vjk): -                    package_links.extend(self._getLinks(crypted, jk)) +                    package_links.extend(self._get_links(crypted, jk))              except Exception: -                self.logDebug("Unable to decrypt CNL2 links") +                self.log_debug("Unable to decrypt CNL2 links")          return package_links -    def handleDLCLinks(self): -        self.logDebug("Search for DLC links") +    def handle_DLC_links(self): +        self.log_debug("Search for DLC links")          package_links = []          m = re.search(self.DLC_LINK_REGEX, self.html)          if m:              container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid -            self.logDebug("Downloading DLC container link [%s]" % container_url) +            self.log_debug("Downloading DLC container link [%s]" % container_url)              try:                  dlc = self.load(container_url)                  dlc_filename = self.fileid + ".dlc" -                dlc_filepath = save_join(self.config['general']['download_folder'], dlc_filename) +                dlc_filepath = fs_join(self.pyload.config.get("general", "download_folder"), dlc_filename)                  with open(dlc_filepath, "wb") as f:                      f.write(dlc)                  package_links.append(dlc_filepath) @@ -230,64 +231,63 @@ class RelinkUs(Crypter):          return package_links -    def handleWEBLinks(self): -        self.logDebug("Search for WEB links") +    def handle_WEB_links(self): +        self.log_debug("Search for WEB links")          package_links = []          params        = re.findall(self.WEB_FORWARD_REGEX, self.html) -        self.logDebug("Decrypting %d Web links" % len(params)) +        self.log_debug("Decrypting %d Web links" % len(params))          for index, param in enumerate(params):              try:                  url = self.WEB_FORWARD_URL + "?%s" % param -                self.logDebug("Decrypting Web link %d, %s" % (index + 1, url)) +                self.log_debug("Decrypting Web link %d, %s" % (index + 1, url)) -                res  = self.load(url, decode=True) +                res  = self.load(url)                  link = re.search(self.WEB_LINK_REGEX, res).group(1)                  package_links.append(link)              except Exception, detail: -                self.logDebug("Error decrypting Web link %s, %s" % (index, detail)) +                self.log_debug("Error decrypting Web link %s, %s" % (index, detail)) -            self.setWait(4) -            self.wait() +            self.wait(4)          return package_links -    def _getCipherParams(self, cnl2_form): -        # Get jk +    def _get_cipher_params(self, cnl2_form): +        #: Get jk          jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY          vjk = re.findall(jk_re, cnl2_form, re.I) -        # Get crypted +        #: Get crypted          crypted_re = self.CNL2_FORMINPUT_REGEX % RelinkUs.CNL2_CRYPTED_KEY          vcrypted = re.findall(crypted_re, cnl2_form, re.I) -        # Log and return -        self.logDebug("Detected %d crypted blocks" % len(vcrypted)) +        #: Log and return +        self.log_debug("Detected %d crypted blocks" % len(vcrypted))          return vcrypted, vjk -    def _getLinks(self, crypted, jk): -        # Get key +    def _get_links(self, crypted, jk): +        #: Get key          jreturn = self.js.eval("%s f()" % jk) -        self.logDebug("JsEngine returns value [%s]" % jreturn) +        self.log_debug("JsEngine returns value [%s]" % jreturn)          key = binascii.unhexlify(jreturn) -        # Decrypt +        #: Decrypt          Key = key          IV = key          obj = AES.new(Key, AES.MODE_CBC, IV)          text = obj.decrypt(crypted.decode('base64')) -        # Extract links +        #: Extract links          text = text.replace("\x00", "").replace("\r", "")          links = filter(bool, text.split('\n')) -        # Log and return -        self.logDebug("Package has %d links" % len(links)) +        #: Log and return +        self.log_debug("Package has %d links" % len(links))          return links diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 5d822af11..e2b8471ab 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -2,17 +2,18 @@  import re -from BeautifulSoup import BeautifulSoup +import BeautifulSoup  from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.internal.Crypter import Crypter +from module.plugins.captcha.SolveMedia import SolveMedia  class SafelinkingNet(Crypter):      __name__    = "SafelinkingNet"      __type__    = "crypter" -    __version__ = "0.15" +    __version__ = "0.17" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -43,7 +44,7 @@ class SafelinkingNet(Crypter):              self.html = self.load(url)              if "link-password" in self.html: -                postData['link-password'] = self.getPassword() +                postData['link-password'] = self.get_password()              if "altcaptcha" in self.html:                  for _i in xrange(5): @@ -66,7 +67,7 @@ class SafelinkingNet(Crypter):                          break              pyfile.package().password = "" -            soup = BeautifulSoup(self.html) +            soup = BeautifulSoup.BeautifulSoup(self.html)              scripts = soup.findAll("script")              for s in scripts:                  if "d_links" in s.text: diff --git a/module/plugins/crypter/SecuredIn.py b/module/plugins/crypter/SecuredIn.py index a2eac4f13..95416585a 100644 --- a/module/plugins/crypter/SecuredIn.py +++ b/module/plugins/crypter/SecuredIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class SecuredIn(DeadCrypter):      __name__    = "SecuredIn"      __type__    = "crypter" -    __version__ = "0.21" +    __version__ = "0.22" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+-\w{8}\.html'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 06dcf547e..7942d5e42 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -2,13 +2,14 @@  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class SexuriaCom(Crypter):      __name__    = "SexuriaCom"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -19,76 +20,76 @@ class SexuriaCom(Crypter):      __authors__     = [("NETHead", "NETHead.AT.gmx.DOT.net")] -    PATTERN_SUPPORTED_MAIN     = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html', re.I) -    PATTERN_SUPPORTED_CRYPT    = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html', re.I) -    PATTERN_SUPPORTED_REDIRECT = re.compile(r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+', re.I) -    PATTERN_TITLE              = re.compile(r'<title> - (?P<TITLE>.*) Sexuria - Kostenlose Pornos - Rapidshare XXX Porn</title>', re.I) -    PATTERN_PASSWORD           = re.compile(r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>', re.I | re.S) -    PATTERN_DL_LINK_PAGE       = re.compile(r'"(dl_links_\d+_\d+\.html)"', re.I) -    PATTERN_REDIRECT_LINKS     = re.compile(r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly', re.I) +    PATTERN_SUPPORTED_MAIN     = r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html' +    PATTERN_SUPPORTED_CRYPT    = r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html' +    PATTERN_SUPPORTED_REDIRECT = r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+' +    PATTERN_TITLE              = r'<title> - (?P<TITLE>.*) Sexuria - Kostenlose Pornos - Rapidshare XXX Porn</title>' +    PATTERN_PASSWORD           = r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>' +    PATTERN_DL_LINK_PAGE       = r'"(dl_links_\d+_\d+\.html)"' +    PATTERN_REDIRECT_LINKS     = r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly'      def decrypt(self, pyfile): -        # Init +        #: Init          self.pyfile = pyfile          self.package = pyfile.package() -        # Get package links -        package_name, self.links, folder_name, package_pwd = self.decryptLinks(self.pyfile.url) +        #: Get package links +        package_name, self.links, folder_name, package_pwd = self.decrypt_links(self.pyfile.url)          self.packages = [(package_name, self.links, folder_name)] -    def decryptLinks(self, url): +    def decrypt_links(self, url):          linklist = [] -        name = self.package.name -        folder = self.package.folder +        name     = self.package.name +        folder   = self.package.folder          password = None -        if re.match(self.PATTERN_SUPPORTED_MAIN, url): -            # Processing main page +        if re.match(self.PATTERN_SUPPORTED_MAIN, url, re.I): +            #: Processing main page              html = self.load(url) -            links = re.findall(self.PATTERN_DL_LINK_PAGE, html) +            links = re.findall(self.PATTERN_DL_LINK_PAGE, html, re.I)              for link in links:                  linklist.append("http://sexuria.com/v1/" + link) -        elif re.match(self.PATTERN_SUPPORTED_REDIRECT, url): -            # Processing direct redirect link (out.php), redirecting to main page -            id = re.search(self.PATTERN_SUPPORTED_REDIRECT, url).group('ID') +        elif re.match(self.PATTERN_SUPPORTED_REDIRECT, url, re.I): +            #: Processing direct redirect link (out.php), redirecting to main page +            id = re.search(self.PATTERN_SUPPORTED_REDIRECT, url, re.I).group('ID')              if id:                  linklist.append("http://sexuria.com/v1/Pornos_Kostenlos_liebe_%s.html" % id) -        elif re.match(self.PATTERN_SUPPORTED_CRYPT, url): -            # Extract info from main file -            id = re.search(self.PATTERN_SUPPORTED_CRYPT, url).group('ID') -            html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id, decode=True) +        elif re.match(self.PATTERN_SUPPORTED_CRYPT, url, re.I): +            #: Extract info from main file +            id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID') +            html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) -            title = re.search(self.PATTERN_TITLE, html).group('TITLE').strip() +            title = re.search(self.PATTERN_TITLE, html, re.I).group('TITLE').strip()              if title:                  name = folder = title -                self.logDebug("Package info found, name [%s] and folder [%s]" % (name, folder)) +                self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder)) -            pwd = re.search(self.PATTERN_PASSWORD, html).group('PWD') -            if pwd: +            pwd = re.search(self.PATTERN_PASSWORD, html, re.I | re.S).group('PWD') +            if pwd and pwd not in ("Kein Passwort", "-"):                  password = pwd.strip() -                self.logDebug("Password info [%s] found" % password) +                self.log_debug("Password info [%s] found" % password) -            # Process link (dl_link) +            #: Process link (dl_link)              html = self.load(url) -            links = re.findall(self.PATTERN_REDIRECT_LINKS, html) +            links = re.findall(self.PATTERN_REDIRECT_LINKS, html, re.I)              if len(links) == 0: -                self.LogError("Broken for link %s" % link) +                self.log_error(_("Broken for link: %s") % link)              else:                  for link in links:                      link = link.replace("http://sexuria.com/", "http://www.sexuria.com/")                      finallink = self.load(link, just_header=True)['location']                      if not finallink or "sexuria.com/" in finallink: -                        self.LogError("Broken for link %s" % link) +                        self.log_error(_("Broken for link: %s") % link)                      else:                          linklist.append(finallink) -        # Debug log -        self.logDebug("%d supported links" % len(linklist)) +        #: Debug log +        self.log_debug("%d supported links" % len(linklist))          for i, link in enumerate(linklist): -            self.logDebug("Supported link %d, %s" % (i + 1, link)) +            self.log_debug("Supported link %d, %s" % (i + 1, link))          return name, linklist, folder, password diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py new file mode 100644 index 000000000..754bc542c --- /dev/null +++ b/module/plugins/crypter/ShSt.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.Crypter import Crypter + +import pycurl +import re + + +class ShSt(Crypter): +    __name__    = "ShSt" +    __type__    = "crypter" +    __version__ = "0.04" +    __status__  = "testing" + +    __pattern__ = r'http://sh\.st/\w+' + +    __description__ = """Sh.St decrypter plugin""" +    __license__     = "GPLv3" +    __authors__     = [("Frederik Möllers", "fred-public@posteo.de")] + + +    NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>' + + +    def decrypt(self, pyfile): +        #: If we use curl as a user agent, we will get a straight redirect (no waiting!) +        self.req.http.c.setopt(pycurl.USERAGENT, "curl/7.42.1") +        #: Fetch the target URL +        header = self.load(self.pyfile.url, just_header = True, decode = False) +        target_url = header['location'] +        self.urls.append(target_url) diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index f17ba54d7..6fbe59b38 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -4,13 +4,14 @@ import binascii  import re  from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class ShareLinksBiz(Crypter):      __name__    = "ShareLinksBiz"      __type__    = "crypter" -    __version__ = "1.14" +    __version__ = "1.16" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -22,113 +23,113 @@ class ShareLinksBiz(Crypter):      def setup(self): -        self.baseUrl = None -        self.fileId = None +        self.base_url = None +        self.file_id = None          self.package = None          self.captcha = False      def decrypt(self, pyfile): -        # Init -        self.initFile(pyfile) +        #: Init +        self.init_file(pyfile) -        # Request package -        url = self.baseUrl + '/' + self.fileId -        self.html = self.load(url, decode=True) +        #: Request package +        url = self.base_url + '/' + self.file_id +        self.html = self.load(url) -        # Unblock server (load all images) -        self.unblockServer() +        #: Unblock server (load all images) +        self.unblock_server() -        # Check for protection -        if self.isPasswordProtected(): -            self.unlockPasswordProtection() -            self.handleErrors() +        #: Check for protection +        if self.is_password_protected(): +            self.unlock_password_protection() +            self.handle_errors() -        if self.isCaptchaProtected(): +        if self.is_captcha_protected():              self.captcha = True -            self.unlockCaptchaProtection() -            self.handleErrors() +            self.unlock_captcha_protection() +            self.handle_errors() -        # Extract package links +        #: Extract package links          package_links = [] -        package_links.extend(self.handleWebLinks()) -        package_links.extend(self.handleContainers()) -        package_links.extend(self.handleCNL2()) +        package_links.extend(self.handle_web_links()) +        package_links.extend(self.handle_containers()) +        package_links.extend(self.handle_CNL2())          package_links = set(package_links) -        # Get package info -        package_name, package_folder = self.getPackageInfo() +        #: Get package info +        package_name, package_folder = self.get_package_info() -        # Pack +        #: Pack          self.packages = [(package_name, package_links, package_folder)] -    def initFile(self, pyfile): +    def init_file(self, pyfile):          url = pyfile.url          if 's2l.biz' in url:              url = self.load(url, just_header=True)['location'] -        self.baseUrl = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1) -        self.fileId = re.match(self.__pattern__, url).group('ID') +        self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1) +        self.file_id = re.match(self.__pattern__, url).group('ID')          self.package = pyfile.package() -    def isOnline(self): +    def is_online(self):          if "No usable content was found" in self.html: -            self.logDebug("File not found") +            self.log_debug("File not found")              return False          return True -    def isPasswordProtected(self): -        if re.search(r'''<form.*?id="passwordForm".*?>''', self.html): -            self.logDebug("Links are protected") +    def is_password_protected(self): +        if re.search(r'<form.*?id="passwordForm".*?>', self.html): +            self.log_debug("Links are protected")              return True          return False -    def isCaptchaProtected(self): +    def is_captcha_protected(self):          if '<map id="captchamap"' in self.html: -            self.logDebug("Links are captcha protected") +            self.log_debug("Links are captcha protected")              return True          return False -    def unblockServer(self): +    def unblock_server(self):          imgs = re.findall(r"(/template/images/.*?\.gif)", self.html)          for img in imgs: -            self.load(self.baseUrl + img) +            self.load(self.base_url + img) -    def unlockPasswordProtection(self): -        password = self.getPassword() -        self.logDebug("Submitting password [%s] for protected links" % password) -        post = {"password": password, 'login': 'Submit form'} -        url = self.baseUrl + '/' + self.fileId -        self.html = self.load(url, post=post, decode=True) +    def unlock_password_protection(self): +        password = self.get_password() +        self.log_debug("Submitting password [%s] for protected links" % password) +        post = {'password': password, 'login': 'Submit form'} +        url = self.base_url + '/' + self.file_id +        self.html = self.load(url, post=post) -    def unlockCaptchaProtection(self): -        # Get captcha map -        captchaMap = self._getCaptchaMap() -        self.logDebug("Captcha map with [%d] positions" % len(captchaMap.keys())) +    def unlock_captcha_protection(self): +        #: Get captcha map +        captchaMap = self._get_captcha_map() +        self.log_debug("Captcha map with [%d] positions" % len(captchaMap.keys())) -        # Request user for captcha coords +        #: Request user for captcha coords          m = re.search(r'<img src="/captcha.gif\?d=(.*?)&PHPSESSID=(.*?)&legend=1"', self.html) -        captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) -        self.logDebug("Waiting user for correct position") -        coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional') -        self.logDebug("Captcha resolved, coords [%s]" % str(coords)) +        captchaUrl = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) +        self.log_debug("Waiting user for correct position") +        coords = self.captcha.decrypt(captchaUrl, input_type="gif", output_type='positional') +        self.log_debug("Captcha resolved, coords [%s]" % str(coords)) -        # Resolve captcha -        href = self._resolveCoords(coords, captchaMap) +        #: Resolve captcha +        href = self._resolve_coords(coords, captchaMap)          if href is None: -            self.invalidCaptcha() +            self.captcha.invalid()              self.retry(wait_time=5) -        url = self.baseUrl + href -        self.html = self.load(url, decode=True) +        url = self.base_url + href +        self.html = self.load(url) -    def _getCaptchaMap(self): +    def _get_captcha_map(self):          mapp = {}          for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html):              rect = eval('(' + m.group(1) + ')') @@ -137,66 +138,66 @@ class ShareLinksBiz(Crypter):          return mapp -    def _resolveCoords(self, coords, captchaMap): +    def _resolve_coords(self, coords, captchaMap):          x, y = coords -        for rect, href in captchaMap.iteritems(): +        for rect, href in captchaMap.items():              x1, y1, x2, y2 = rect              if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):                  return href -    def handleErrors(self): +    def handle_errors(self):          if "The inserted password was wrong" in self.html: -            self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") +            self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry")              self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry"))          if self.captcha:              if "Your choice was wrong" in self.html: -                self.invalidCaptcha() +                self.captcha.invalid()                  self.retry(wait_time=5)              else: -                self.correctCaptcha() +                self.captcha.correct() -    def getPackageInfo(self): +    def get_package_info(self):          name = folder = None -        # Extract from web package header +        #: Extract from web package header          title_re = r'<h2><img.*?/>(.*)</h2>'          m = re.search(title_re, self.html, re.S)          if m:              title = m.group(1).strip()              if 'unnamed' not in title:                  name = folder = title -                self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) +                self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder)) -        # Fallback to defaults +        #: Fallback to defaults          if not name or not folder:              name = self.package.name              folder = self.package.folder -            self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) +            self.log_debug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) -        # Return package info +        #: Return package info          return name, folder -    def handleWebLinks(self): +    def handle_web_links(self):          package_links = [] -        self.logDebug("Handling Web links") +        self.log_debug("Handling Web links")          #@TODO: Gather paginated web links          pattern = r'javascript:_get\(\'(.*?)\', \d+, \'\'\)'          ids = re.findall(pattern, self.html) -        self.logDebug("Decrypting %d Web links" % len(ids)) +        self.log_debug("Decrypting %d Web links" % len(ids))          for i, ID in enumerate(ids):              try: -                self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, ID)) +                self.log_debug("Decrypting Web link %d, [%s]" % (i + 1, ID)) -                dwLink = self.baseUrl + "/get/lnk/" + ID +                dwLink = self.base_url + "/get/lnk/" + ID                  res = self.load(dwLink)                  code = re.search(r'frm/(\d+)', res).group(1) -                fwLink = self.baseUrl + "/get/frm/" + code +                fwLink = self.base_url + "/get/frm/" + code                  res = self.load(fwLink)                  jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', res, re.S).group(1) @@ -205,75 +206,75 @@ class ShareLinksBiz(Crypter):                  dlLink = self.js.eval(jslauncher % jscode) -                self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) +                self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink)                  package_links.append(dlLink)              except Exception, detail: -                self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail)) +                self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail))          return package_links -    def handleContainers(self): +    def handle_containers(self):          package_links = [] -        self.logDebug("Handling Container links") +        self.log_debug("Handling Container links")          pattern = r'javascript:_get\(\'(.*?)\', 0, \'(rsdf|ccf|dlc)\'\)'          containersLinks = re.findall(pattern, self.html) -        self.logDebug("Decrypting %d Container links" % len(containersLinks)) +        self.log_debug("Decrypting %d Container links" % len(containersLinks))          for containerLink in containersLinks: -            link = "%s/get/%s/%s" % (self.baseUrl, containerLink[1], containerLink[0]) +            link = "%s/get/%s/%s" % (self.base_url, containerLink[1], containerLink[0])              package_links.append(link)          return package_links -    def handleCNL2(self): +    def handle_CNL2(self):          package_links = [] -        self.logDebug("Handling CNL2 links") +        self.log_debug("Handling CNL2 links")          if '/lib/cnl2/ClicknLoad.swf' in self.html:              try: -                (crypted, jk) = self._getCipherParams() -                package_links.extend(self._getLinks(crypted, jk)) +                (crypted, jk) = self._get_cipher_params() +                package_links.extend(self._get_links(crypted, jk))              except Exception:                  self.fail(_("Unable to decrypt CNL2 links"))          return package_links -    def _getCipherParams(self): -        # Request CNL2 +    def _get_cipher_params(self): +        #: Request CNL2          code   = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) -        url    = "%s/get/cnl2/%s" % (self.baseUrl, code) +        url    = "%s/get/cnl2/%s" % (self.base_url, code)          res    = self.load(url)          params = res.split(";;") -        # Get jk +        #: Get jk          strlist = list(params[1].decode('base64')) -        jk      = ''.join(strlist[::-1]) +        jk      = "".join(strlist[::-1]) -        # Get crypted +        #: Get crypted          strlist = list(params[2].decode('base64')) -        crypted = ''.join(strlist[::-1]) +        crypted = "".join(strlist[::-1]) -        # Log and return +        #: Log and return          return crypted, jk -    def _getLinks(self, crypted, jk): -        # Get key +    def _get_links(self, crypted, jk): +        #: Get key          jreturn = self.js.eval("%s f()" % jk) -        self.logDebug("JsEngine returns value [%s]" % jreturn) +        self.log_debug("JsEngine returns value [%s]" % jreturn)          key = binascii.unhexlify(jreturn) -        # Decrypt +        #: Decrypt          Key = key          IV = key          obj = AES.new(Key, AES.MODE_CBC, IV)          text = obj.decrypt(crypted.decode('base64')) -        # Extract links +        #: Extract links          text = text.replace("\x00", "").replace("\r", "")          links = filter(bool, text.split('\n')) -        # Log and return -        self.logDebug("Block has %d links" % len(links)) +        #: Log and return +        self.log_debug("Block has %d links" % len(links))          return links diff --git a/module/plugins/crypter/SharingmatrixComFolder.py b/module/plugins/crypter/SharingmatrixComFolder.py index eb1b4d8a6..bd35cfd8e 100644 --- a/module/plugins/crypter/SharingmatrixComFolder.py +++ b/module/plugins/crypter/SharingmatrixComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class SharingmatrixComFolder(DeadCrypter):      __name__    = "SharingmatrixComFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/folder/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrgFolder.py index af768ef7b..736d59720 100644 --- a/module/plugins/crypter/SpeedLoadOrgFolder.py +++ b/module/plugins/crypter/SpeedLoadOrgFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class SpeedLoadOrgFolder(DeadCrypter):      __name__    = "SpeedLoadOrgFolder"      __type__    = "crypter" -    __version__ = "0.30" +    __version__ = "0.31" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?speedload\.org/(\d+~f$|folder/\d+/)'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/StealthTo.py b/module/plugins/crypter/StealthTo.py index 551468980..3a175cd87 100644 --- a/module/plugins/crypter/StealthTo.py +++ b/module/plugins/crypter/StealthTo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class StealthTo(DeadCrypter):      __name__    = "StealthTo"      __type__    = "crypter" -    __version__ = "0.20" +    __version__ = "0.21" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?stealth\.to/folder/.+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py new file mode 100644 index 000000000..6ba1ee19b --- /dev/null +++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo + + +class TNTVillageScambioeticoOrg(SimpleCrypter): +    __name__    = "TNTVillageScambioeticoOrg" +    __type__    = "crypter" +    __version__ = "0.02" +    __status__  = "testing" + +    __pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+' +    __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True),  #: Overrides pyload.config['general']['folder_per_package'] +                   ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + +    __description__ = """TNTVillage.scambioetico.org decrypter plugin""" +    __license__     = "GPLv3" +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] + + +    LINK_PATTERNS = [r'<th class="titlemedium"><a href=\'(.+?)\'', r"<a href='(\./index\.php\?act.+?)'"] + + +    def get_links(self): +        for p in self.LINK_PATTERNS: +            self.LINK_PATTERN = p +            links = super(TNTVillageScambioeticoOrg, self).getLinks() +            if links: +                return links + + +getInfo = create_getInfo(TNTVillageScambioeticoOrg) diff --git a/module/plugins/crypter/TinyurlCom.py b/module/plugins/crypter/TinyurlCom.py index 4b5b35457..bff1efa12 100644 --- a/module/plugins/crypter/TinyurlCom.py +++ b/module/plugins/crypter/TinyurlCom.py @@ -1,12 +1,13 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class TinyurlCom(SimpleDereferer): +class TinyurlCom(SimpleCrypter):      __name__    = "TinyurlCom"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.03" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?(preview\.)?tinyurl\.com/[\w-]+' diff --git a/module/plugins/crypter/TnyCz.py b/module/plugins/crypter/TnyCz.py index 719c26449..f3fb19cb3 100644 --- a/module/plugins/crypter/TnyCz.py +++ b/module/plugins/crypter/TnyCz.py @@ -1,14 +1,15 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -  import re +from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +  class TnyCz(SimpleCrypter):      __name__    = "TnyCz"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.05" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?tny\.cz/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -20,12 +21,12 @@ class TnyCz(SimpleCrypter):      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    NAME_PATTERN = r'<title>(?P<N>.+) - .+</title>' +    NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>' -    def getLinks(self): +    def get_links(self):          m = re.search(r'<a id=\'save_paste\' href="(.+save\.php\?hash=.+)">', self.html) -        return re.findall(".+", self.load(m.group(1), decode=True)) if m else None +        return re.findall(".+", self.load(m.group(1))) if m else None  getInfo = create_getInfo(TnyCz) diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py index 6f1c90612..03ab004a3 100644 --- a/module/plugins/crypter/TrailerzoneInfo.py +++ b/module/plugins/crypter/TrailerzoneInfo.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class TrailerzoneInfo(DeadCrypter):      __name__    = "TrailerzoneInfo"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?trailerzone\.info/.+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNetFolder.py index dcbd6a5d7..3a36f5032 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNetFolder.py @@ -9,7 +9,8 @@ from module.common.json_layer import json_loads  class TurbobitNetFolder(SimpleCrypter):      __name__    = "TurbobitNetFolder"      __type__    = "crypter" -    __version__ = "0.05" +    __version__ = "0.06" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?turbobit\.net/download/folder/(?P<ID>\w+)'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), @@ -25,24 +26,22 @@ class TurbobitNetFolder(SimpleCrypter):      NAME_PATTERN = r'src=\'/js/lib/grid/icon/folder.png\'> <span>(?P<N>.+?)</span>' -    def _getLinks(self, id, page=1): +    def _get_links(self, id, page=1):          gridFile = self.load("http://turbobit.net/downloadfolder/gridFile", -                             get={"rootId": id, "rows": 200, "page": page}, decode=True) +                             get={'rootId': id, 'rows': 200, 'page': page})          grid = json_loads(gridFile)          if grid['rows']:              for i in grid['rows']:                  yield i['id'] -            for id in self._getLinks(id, page + 1): +            for id in self._get_links(id, page + 1):                  yield id          else:              return -    def getLinks(self): -        id = re.match(self.__pattern__, self.pyfile.url).group('ID') -        fixurl = lambda id: "http://turbobit.net/%s.html" % id -        return map(fixurl, self._getLinks(id)) +    def get_links(self): +        return ["http://turbobit.net/%s.html" % id for id in self._get_links(self.info['pattern']['ID'])]  getInfo = create_getInfo(TurbobitNetFolder) diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py index 1cc505b81..684fb1e46 100644 --- a/module/plugins/crypter/TusfilesNetFolder.py +++ b/module/plugins/crypter/TusfilesNetFolder.py @@ -10,7 +10,8 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo  class TusfilesNetFolder(XFSCrypter):      __name__    = "TusfilesNetFolder"      __type__    = "crypter" -    __version__ = "0.08" +    __version__ = "0.09" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -27,11 +28,11 @@ class TusfilesNetFolder(XFSCrypter):      URL_REPLACEMENTS = [(__pattern__ + ".*", r'https://www.tusfiles.net/go/\g<ID>/')] -    def loadPage(self, page_n): -        return self.load(urlparse.urljoin(self.pyfile.url, str(page_n)), decode=True) +    def load_page(self, page_n): +        return self.load(urlparse.urljoin(self.pyfile.url, str(page_n))) -    def handlePages(self, pyfile): +    def handle_pages(self, pyfile):          pages = re.search(self.PAGES_PATTERN, self.html)          if pages:              pages = int(math.ceil(int(pages.group('pages')) / 25.0)) @@ -39,8 +40,8 @@ class TusfilesNetFolder(XFSCrypter):              return          for p in xrange(2, pages + 1): -            self.html = self.loadPage(p) -            self.links += self.getLinks() +            self.html = self.load_page(p) +            self.links += self.get_links()  getInfo = create_getInfo(TusfilesNetFolder) diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index 3f2a60cf7..19569ef31 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -1,13 +1,14 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class UlozToFolder(Crypter):      __name__    = "UlozToFolder"      __type__    = "crypter" -    __version__ = "0.20" +    __version__ = "0.22" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(m|soubory)/.+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -28,7 +29,7 @@ class UlozToFolder(Crypter):          new_links = []          for i in xrange(1, 100): -            self.logInfo(_("Fetching links from page %i") % i) +            self.log_info(_("Fetching links from page %i") % i)              m = re.search(self.FOLDER_PATTERN, html, re.S)              if m is None:                  self.error(_("FOLDER_PATTERN not found")) @@ -40,7 +41,7 @@ class UlozToFolder(Crypter):              else:                  break          else: -            self.logInfo(_("Limit of 99 pages reached, aborting")) +            self.log_info(_("Limit of 99 pages reached, aborting"))          if new_links:              self.urls = [map(lambda s: "http://ulozto.net/%s" % s, new_links)] diff --git a/module/plugins/crypter/UploadableChFolder.py b/module/plugins/crypter/UploadableChFolder.py index f1eb93323..767e989d5 100644 --- a/module/plugins/crypter/UploadableChFolder.py +++ b/module/plugins/crypter/UploadableChFolder.py @@ -6,14 +6,15 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class UploadableChFolder(SimpleCrypter):      __name__    = "UploadableChFolder"      __type__    = "crypter" -    __version__ = "0.03" +    __version__ = "0.04" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?uploadable\.ch/list/\w+'      __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True),                     ("use_subfolder"     , "bool", "Save package to subfolder"          , True),                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] -    __description__ = """ Uploadable.ch folder decrypter plugin """ +    __description__ = """Uploadable.ch folder decrypter plugin"""      __license__     = "GPLv3"      __authors__     = [("guidobelix", "guidobelix@hotmail.it"),                         ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index d54ed47eb..381d744fe 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -9,11 +9,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo  class UploadedToFolder(SimpleCrypter):      __name__    = "UploadedToFolder"      __type__    = "crypter" -    __version__ = "0.42" +    __version__ = "0.44" +    __status__  = "testing" -    __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<ID>\w+)' -    __config__  = [("use_premium"       , "bool", "Use premium account if available"   , True), -                   ("use_subfolder"     , "bool", "Save package to subfolder"          , True), +    __pattern__ = r'https?://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/\w+' +    __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True),                     ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]      __description__ = """UploadedTo decrypter plugin""" @@ -21,17 +21,11 @@ class UploadedToFolder(SimpleCrypter):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    PLAIN_PATTERN = r'<small class="date"><a href="([\w/]+)" onclick=' -    NAME_PATTERN = r'<title>(?P<N>.+?)<' +    NAME_PATTERN         = r'<title>(?P<N>.+?)<' +    OFFLINE_PATTERN      = r'>Page not found' +    TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' - -    def getLinks(self): -        m = re.search(self.PLAIN_PATTERN, self.html) -        if m is None: -            self.error(_("PLAIN_PATTERN not found")) - -        plain_link = urlparse.urljoin("http://uploaded.net/", m.group(1)) -        return self.load(plain_link).split('\n')[:-1] +    LINK_PATTERN = r'<h2><a href="(.+?)"'  getInfo = create_getInfo(UploadedToFolder) diff --git a/module/plugins/crypter/WiiReloadedOrg.py b/module/plugins/crypter/WiiReloadedOrg.py index eddc0e5d1..7679836d2 100644 --- a/module/plugins/crypter/WiiReloadedOrg.py +++ b/module/plugins/crypter/WiiReloadedOrg.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class WiiReloadedOrg(DeadCrypter):      __name__    = "WiiReloadedOrg"      __type__    = "crypter" -    __version__ = "0.11" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?wii-reloaded\.org/protect/get\.php\?i=.+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/WuploadComFolder.py b/module/plugins/crypter/WuploadComFolder.py index dece467a2..da1fa9bac 100644 --- a/module/plugins/crypter/WuploadComFolder.py +++ b/module/plugins/crypter/WuploadComFolder.py @@ -6,7 +6,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo  class WuploadComFolder(DeadCrypter):      __name__    = "WuploadComFolder"      __type__    = "crypter" -    __version__ = "0.01" +    __version__ = "0.02" +    __status__  = "testing"      __pattern__ = r'http://(?:www\.)?wupload\.com/folder/\w+'      __config__  = []  #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index 2e1a2f022..584cc7668 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo  class XFileSharingProFolder(XFSCrypter):      __name__    = "XFileSharingProFolder"      __type__    = "crypter" -    __version__ = "0.06" +    __version__ = "0.13" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), @@ -19,34 +20,56 @@ class XFileSharingProFolder(XFSCrypter):      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    def _log(self, type, args): -        msg = " | ".join(str(a).strip() for a in args if a) -        logger = getattr(self.log, type) -        logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) +    def _log(self, level, plugintype, pluginname, messages): +        return super(XFileSharingProFolder, self)._log(level, +                                                       plugintype, +                                                       "%s: %s" % (pluginname, self.HOSTER_NAME), +                                                       messages)      def init(self):          super(XFileSharingProFolder, self).init() -        self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] +        self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern']          self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() -        self.HOSTER_NAME   = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') +        self.HOSTER_NAME   = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') -        account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) -        if account and account.canUse(): -            self.account = account - -        elif self.account: -            self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN +    def _setup(self): +        account_name     = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME +        self.chunk_limit = 1 +        self.multiDL     = True +        if self.account: +            self.req             = self.pyload.requestFactory.getRequest(accountname, self.user) +            self.premium         = self.account.is_premium(self.user) +            self.resume_download = self.premium          else: -            return +            self.req             = self.pyload.requestFactory.getRequest(account_name) +            self.premium         = False +            self.resume_download = False + + +    def load_account(self): +        if self.req: +            self.req.close() + +        if not self.account: +            self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + +        if not self.account: +            self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) + +        if self.account: +            if not self.account.HOSTER_DOMAIN: +                self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + +            if not self.user: +                self.user = self.account.select()[0] -        self.user, data = self.account.selectAccount() -        self.req        = self.account.getAccountRequest(self.user) -        self.premium    = self.account.isPremium(self.user) +            if not self.user or not self.account.is_logged(self.user, True): +                self.account = False  getInfo = create_getInfo(XFileSharingProFolder) diff --git a/module/plugins/crypter/XupPl.py b/module/plugins/crypter/XupPl.py index 5ab6750c4..ac918a6de 100644 --- a/module/plugins/crypter/XupPl.py +++ b/module/plugins/crypter/XupPl.py @@ -1,12 +1,13 @@  # -*- coding: utf-8 -*- -from module.plugins.Crypter import Crypter +from module.plugins.internal.Crypter import Crypter  class XupPl(Crypter):      __name__    = "XupPl"      __type__    = "crypter" -    __version__ = "0.10" +    __version__ = "0.12" +    __status__  = "testing"      __pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.+'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index a2b02b2f1..ea09c63f9 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -4,14 +4,15 @@ import re  import urlparse  from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.utils import save_join +from module.plugins.internal.Crypter import Crypter +from module.utils import save_join as fs_join  class YoutubeComFolder(Crypter):      __name__    = "YoutubeComFolder"      __type__    = "crypter" -    __version__ = "1.01" +    __version__ = "1.03" +    __status__  = "testing"      __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True ), @@ -29,36 +30,36 @@ class YoutubeComFolder(Crypter):      def api_response(self, ref, req): -        req.update({"key": self.API_KEY}) +        req.update({'key': self.API_KEY})          url  = urlparse.urljoin("https://www.googleapis.com/youtube/v3/", ref)          html = self.load(url, get=req)          return json_loads(html) -    def getChannel(self, user): -        channels = self.api_response("channels", {"part": "id,snippet,contentDetails", "forUsername": user, "maxResults": "50"}) +    def get_channel(self, user): +        channels = self.api_response("channels", {'part': "id,snippet,contentDetails", 'forUsername': user, 'maxResults': "50"})          if channels['items']:              channel = channels['items'][0] -            return {"id": channel['id'], -                    "title": channel['snippet']['title'], -                    "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], -                    "user": user}  # One lone channel for user? +            return {'id': channel['id'], +                    'title': channel['snippet']['title'], +                    'relatedPlaylists': channel['contentDetails']['relatedPlaylists'], +                    'user': user}  #: One lone channel for user? -    def getPlaylist(self, p_id): -        playlists = self.api_response("playlists", {"part": "snippet", "id": p_id}) +    def get_playlist(self, p_id): +        playlists = self.api_response("playlists", {'part': "snippet", 'id': p_id})          if playlists['items']:              playlist = playlists['items'][0] -            return {"id": p_id, -                    "title": playlist['snippet']['title'], -                    "channelId": playlist['snippet']['channelId'], -                    "channelTitle": playlist['snippet']['channelTitle']} +            return {'id': p_id, +                    'title': playlist['snippet']['title'], +                    'channelId': playlist['snippet']['channelId'], +                    'channelTitle': playlist['snippet']['channelTitle']} -    def _getPlaylists(self, id, token=None): -        req = {"part": "id", "maxResults": "50", "channelId": id} +    def _get_playlists(self, id, token=None): +        req = {'part': "id", 'maxResults': "50", 'channelId': id}          if token: -            req.update({"pageToken": token}) +            req.update({'pageToken': token})          playlists = self.api_response("playlists", req) @@ -66,18 +67,18 @@ class YoutubeComFolder(Crypter):              yield playlist['id']          if "nextPageToken" in playlists: -            for item in self._getPlaylists(id, playlists['nextPageToken']): +            for item in self._get_playlists(id, playlists['nextPageToken']):                  yield item -    def getPlaylists(self, ch_id): -        return map(self.getPlaylist, self._getPlaylists(ch_id)) +    def get_playlists(self, ch_id): +        return map(self.get_playlist, self._get_playlists(ch_id)) -    def _getVideosId(self, id, token=None): -        req = {"part": "contentDetails", "maxResults": "50", "playlistId": id} +    def _get_videos_id(self, id, token=None): +        req = {'part': "contentDetails", 'maxResults': "50", 'playlistId': id}          if token: -            req.update({"pageToken": token}) +            req.update({'pageToken': token})          playlist = self.api_response("playlistItems", req) @@ -85,12 +86,12 @@ class YoutubeComFolder(Crypter):              yield item['contentDetails']['videoId']          if "nextPageToken" in playlist: -            for item in self._getVideosId(id, playlist['nextPageToken']): +            for item in self._get_videos_id(id, playlist['nextPageToken']):                  yield item -    def getVideosId(self, p_id): -        return list(self._getVideosId(p_id)) +    def get_videos_id(self, p_id): +        return list(self._get_videos_id(p_id))      def decrypt(self, pyfile): @@ -99,29 +100,29 @@ class YoutubeComFolder(Crypter):          m_type = m.group('TYPE')          if m_type == "user": -            self.logDebug("Url recognized as Channel") +            self.log_debug("Url recognized as Channel")              user = m_id -            channel = self.getChannel(user) +            channel = self.get_channel(user)              if channel: -                playlists = self.getPlaylists(channel['id']) -                self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title'])) +                playlists = self.get_playlists(channel['id']) +                self.log_debug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title'])) -                relatedplaylist = {p_name: self.getPlaylist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()} -                self.logDebug("Channel's related playlists found = %s" % relatedplaylist.keys()) +                relatedplaylist = {p_name: self.get_playlist(p_id) for p_name, p_id in channel['relatedPlaylists'].items()} +                self.log_debug("Channel's related playlists found = %s" % relatedplaylist.keys())                  relatedplaylist['uploads']['title'] = "Unplaylisted videos"                  relatedplaylist['uploads']['checkDups'] = True  #: checkDups flag -                for p_name, p_data in relatedplaylist.iteritems(): -                    if self.getConfig(p_name): +                for p_name, p_data in relatedplaylist.items(): +                    if self.get_config(p_name):                          p_data['title'] += " of " + user                          playlists.append(p_data)              else:                  playlists = []          else: -            self.logDebug("Url recognized as Playlist") -            playlists = [self.getPlaylist(m_id)] +            self.log_debug("Url recognized as Playlist") +            playlists = [self.get_playlist(m_id)]          if not playlists:              self.fail(_("No playlist available")) @@ -130,18 +131,18 @@ class YoutubeComFolder(Crypter):          urlize = lambda x: "https://www.youtube.com/watch?v=" + x          for p in playlists:              p_name = p['title'] -            p_videos = self.getVideosId(p['id']) -            p_folder = save_join(self.config['general']['download_folder'], p['channelTitle'], p_name) -            self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) +            p_videos = self.get_videos_id(p['id']) +            p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p['channelTitle'], p_name) +            self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name))              if not p_videos:                  continue              elif "checkDups" in p:                  p_urls = [urlize(v_id) for v_id in p_videos if v_id not in addedvideos] -                self.logDebug("%s video\s available on playlist \"%s\" after duplicates cleanup" % (len(p_urls), p_name)) +                self.log_debug("%s video\s available on playlist \"%s\" after duplicates cleanup" % (len(p_urls), p_name))              else:                  p_urls = map(urlize, p_videos) -            self.packages.append((p_name, p_urls, p_folder))  #: folder is NOT recognized by pyload 0.4.9! +            self.packages.append((p_name, p_urls, p_folder))  #: Folder is NOT recognized by pyload 0.4.9!              addedvideos.extend(p_videos) | 
