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


Python js2py.eval_js方法代码示例

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


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

示例1: eval

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def eval(self, body, domain):

        jsPayload = template(body, domain)

        if js2py.eval_js('(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]') == '1':
            logging.warning('WARNING - Please upgrade your js2py https://github.com/PiotrDabkowski/Js2Py, applying work around for the meantime.')
            jsPayload = jsunfuck(jsPayload)

        def atob(s):
            return base64.b64decode('{}'.format(s)).decode('utf-8')

        js2py.disable_pyimport()
        context = js2py.EvalJs({'atob': atob})
        result = context.eval(jsPayload)

        return result


# ------------------------------------------------------------------------------- # 
开发者ID:a4k-openproject,项目名称:a4kScrapers,代码行数:21,代码来源:js2py.py

示例2: parse_volume_list

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def parse_volume_list(self, soup):
        self.volumes = []
        script = soup.find(name='main').find_next_sibling(name='script').string

        try:
            data = js2py.eval_js(
                '(function() {' + script + 'return window.lnmtl;})()'
            ).to_dict()
            for i, vol in enumerate(data['volumes']):
                title = vol.get('title', '') or ''
                title = re.sub(r'[^\u0000-\u00FF]', '', title)
                title = re.sub(r'\(\)', '', title).strip()
                self.volumes.append(
                    {'id': i + 1, 'title': title, 'download_id': vol['id'],}
                )
            # end for
        except Exception as _:
            logger.exception('Failed parsing one possible batch')
        # end try

        if len(self.volumes) == 0:
            raise Exception('Failed parsing volume list')
        # end if

    # end def 
开发者ID:dipu-bd,项目名称:lightnovel-crawler,代码行数:27,代码来源:lnmtl.py

示例3: convJStoPy

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def convJStoPy(string):
    string = cVunicode(string)
    return js2py.eval_js(string) 
开发者ID:wileyalt,项目名称:kissanime_dl,代码行数:5,代码来源:jsexec.py

示例4: jsFuckDecode

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def jsFuckDecode(string):
    removeeval = string[828:-3]
    return js2py.eval_js(removeeval) 
开发者ID:wileyalt,项目名称:kissanime_dl,代码行数:5,代码来源:jsexec.py

示例5: eval

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def eval(self, jsEnv, js):
        if js2py.eval_js('(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]') == '1':
            logging.warning('WARNING - Please upgrade your js2py https://github.com/PiotrDabkowski/Js2Py, applying work around for the meantime.')
            js = jsunfuck(js)

        def atob(s):
            return base64.b64decode('{}'.format(s)).decode('utf-8')

        js2py.disable_pyimport()
        context = js2py.EvalJs({'atob': atob})
        result = context.eval('{}{}'.format(jsEnv, js))

        return result 
开发者ID:morpheus65535,项目名称:bazarr,代码行数:15,代码来源:js2py.py

示例6: get_configjs

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def get_configjs(filename="example-config.js"):
    with open(filename, "r") as f:
        text = f.read()
    text = text.replace("module.exports = config;","config;")
    return js2py.eval_js(text).to_dict() 
开发者ID:Gab0,项目名称:japonicus,代码行数:7,代码来源:Settings.py

示例7: _eval_id_decoding

# 需要导入模块: import js2py [as 别名]
# 或者: from js2py import eval_js [as 别名]
def _eval_id_decoding(self, webpage, ol_id):
        try:
            # raise # uncomment to test method with pairing
            js_code = re.findall(
                ur"(゚ω゚ノ=.*?\('_'\);.*?)゚ω゚ノ= /`m´)ノ ~┻━┻   //\*´∇`\*/ \['_'\];"
            ,webpage, re.DOTALL)[0]
            #common.log_utils.log_notice('js_code: %s' % js_code)
            js_code = re.sub('''if\s*\([^\}]+?typeof[^\}]+?\}''', '', js_code)
            js_code = re.sub('''if\s*\([^\}]+?document[^\}]+?\}''', '', js_code)
        except Exception as e:
            print 'Could not find JavaScript %s' % e
            raise ResolverError('Could not find JavaScript %s' % e)


        js_code = '''
            var id = "%s"
              , decoded
              , document = {}
              , window = this
              , $ = function(){
                  return {
                    text: function(a){
                      if(a)
                        decoded = a;
                      else
                        return id;
                    },
                    ready: function(a){
                      a()
                    }
                  }
                };
            (function(d){
              var f = function(){};
              var s = '';
              var o = null;
              ['close','createAttribute','createDocumentFragment','createElement','createElementNS','createEvent','createNSResolver','createRange','createTextNode','createTreeWalker','evaluate','execCommand','getElementById','getElementsByName','getElementsByTagName','importNode','open','queryCommandEnabled','queryCommandIndeterm','queryCommandState','queryCommandValue','write','writeln'].forEach(function(e){d[e]=f;});
              ['anchors','applets','body','defaultView','doctype','documentElement','embeds','firstChild','forms','images','implementation','links','location','plugins','styleSheets'].forEach(function(e){d[e]=o;});
              ['URL','characterSet','compatMode','contentType','cookie','designMode','domain','lastModified','referrer','title'].forEach(function(e){d[e]=s;});
            })(document);
            %s;
            decoded;''' % (ol_id, js_code)

        try:
            decoded = js2py.eval_js(js_code)
            if ' ' in decoded or decoded == '':
                raise
            return decoded
        except:
            raise ResolverError('Could not eval ID decoding') 
开发者ID:mrknow,项目名称:filmkodi,代码行数:52,代码来源:openload.py


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