当前位置: 首页>>代码示例>>Python>>正文


Python ReCaptcha.decrypt方法代码示例

本文整理汇总了Python中module.plugins.captcha.ReCaptcha.ReCaptcha.decrypt方法的典型用法代码示例。如果您正苦于以下问题:Python ReCaptcha.decrypt方法的具体用法?Python ReCaptcha.decrypt怎么用?Python ReCaptcha.decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module.plugins.captcha.ReCaptcha.ReCaptcha的用法示例。


在下文中一共展示了ReCaptcha.decrypt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: NCryptIn

# 需要导入模块: from module.plugins.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.captcha.ReCaptcha.ReCaptcha import decrypt [as 别名]
class NCryptIn(Crypter):
    __name__    = "NCryptIn"
    __type__    = "crypter"
    __version__ = "1.41"
    __status__  = "testing"

    __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<TYPE>folder|link|frame)-([^/\?]+)'
    __config__  = [("activated"         , "bool"          , "Activated"                       , True     ),
                   ("use_premium"       , "bool"          , "Use premium account if available", True     ),
                   ("folder_per_package", "Default;Yes;No", "Create folder for each package"  , "Default")]

    __description__ = """NCrypt.in decrypter plugin"""
    __license__     = "GPLv3"
    __authors__     = [("fragonib", "fragonib[AT]yahoo[DOT]es"),
                       ("stickell", "[email protected]")]


    JK_KEY = "jk"
    CRYPTED_KEY = "crypted"

    NAME_PATTERN = r'<meta name="description" content="(?P<N>.+?)"'


    def setup(self):
        self.package = None
        self.cleaned_html = None
        self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"]
        self.protection_type = None


    def decrypt(self, pyfile):
        #: Init
        self.package = pyfile.package()
        pack_links = []
        pack_name = self.package.name
        folder_name = self.package.folder

        #: Deal with single links
        if self.is_single_link():
            pack_links.extend(self.handle_single_link())

        #: Deal with folders
        else:

            #: Request folder home
            self.data = self.request_folder_home()
            self.cleaned_html = self.remove_html_crap(self.data)
            if not self.is_online():
                self.offline()

            #: Check for folder protection
            if self.is_protected():
                self.data = self.unlock_protection()
                self.cleaned_html = self.remove_html_crap(self.data)
                self.handle_errors()

            #: Prepare package name and folder
            (pack_name, folder_name) = self.get_package_info()

            #: Extract package links
            for link_source_type in self.links_source_order:
                pack_links.extend(self.handle_link_source(link_source_type))
                if pack_links:  #: Use only first source which provides links
                    break
            pack_links = set(pack_links)

        #: Pack and return links
        if pack_links:
            self.packages = [(pack_name, pack_links, folder_name)]


    def is_single_link(self):
        link_type = re.match(self.__pattern__, self.pyfile.url).group('TYPE')
        return link_type in ("link", "frame")


    def request_folder_home(self):
        return self.load(self.pyfile.url)


    def remove_html_crap(self, content):
        patterns = (r'(type="hidden".*?(name=".*?")?.*?value=".*?")',
                    r'display:none;">(.*?)</(div|span)>',
                    r'<div\s+class="jdownloader"(.*?)</div>',
                    r'<table class="global">(.*?)</table>',
                    r'<iframe\s+style="display:none(.*?)</iframe>')
        for pattern in patterns:
            rexpr = re.compile(pattern, re.S)
            content = re.sub(rexpr, "", content)
        return content


    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 is_protected(self):
#.........这里部分代码省略.........
开发者ID:EikeKre,项目名称:pyload,代码行数:103,代码来源:NCryptIn.py


注:本文中的module.plugins.captcha.ReCaptcha.ReCaptcha.decrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。