题目地址

https://match.yuanrenxue.com/match/14

视频地址

https://www.bilibili.com/video/BV1ga411Y7wb/

全部代码

python代码

# -*- coding: utf-8 -*-
# @Author: Null119
# @Desc: { YRX14 }
# @Date: 2022/05/12 10:19

import requests,jsonpath,urllib3,re,base64,execjs,time,os
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

session = requests.Session()

sessionid='wwt1peeqctqjolm6z3l1f2ztrn58r6ec'

with open('14.js', mode='r', encoding='utf-8') as f:
    js = f.read()

headers = {
    'user-agent': "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36",
}

mz ="TW96aWxsYSxOZXRzY2FwZSw1LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS84Ni4wLjQyNDAuMTk4IFNhZmFyaS81MzcuMzYsW29iamVjdCBOZXR3b3JrSW5mb3JtYXRpb25dLHRydWUsMSxbb2JqZWN0IEdlb2xvY2F0aW9uXSw0LHpoLUNOLHpoLUNOLHpoLDAsW29iamVjdCBNZWRpYUNhcGFiaWxpdGllc10sW29iamVjdCBNZWRpYVNlc3Npb25dLFtvYmplY3QgTWltZVR5cGVBcnJheV0sdHJ1ZSxbb2JqZWN0IFBlcm1pc3Npb25zXSxXaW4zMixbb2JqZWN0IFBsdWdpbkFycmF5XSxHZWNrbywyMDAzMDEwNyxbb2JqZWN0IFVzZXJBY3RpdmF0aW9uXSxNb3ppbGxhLzUuMCAoV2luZG93cyBOVCAxMC4wOyBXT1c2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC4xOTggU2FmYXJpLzUzNy4zNixHb29nbGUgSW5jLiwsW29iamVjdCBEZXByZWNhdGVkU3RvcmFnZVF1b3RhXSxbb2JqZWN0IERlcHJlY2F0ZWRTdG9yYWdlUXVvdGFdLDEwNDAsMjU2MCwxODUsMTkyMCwyNCwxMDgwLFtvYmplY3QgU2NyZWVuT3JpZW50YXRpb25dLDI0LDE5MjAsW29iamVjdCBET01TdHJpbmdMaXN0XSxmdW5jdGlvbiBhc3NpZ24oKSB7IFtuYXRpdmUgY29kZV0gfSwsbWF0Y2gueXVhbnJlbnh1ZS5jb20sbWF0Y2gueXVhbnJlbnh1ZS5jb20saHR0cHM6Ly9tYXRjaC55dWFucmVueHVlLmNvbS9tYXRjaC8xNCxodHRwczovL21hdGNoLnl1YW5yZW54dWUuY29tLC9tYXRjaC8xNCwsaHR0cHM6LGZ1bmN0aW9uIHJlbG9hZCgpIHsgW25hdGl2ZSBjb2RlXSB9LGZ1bmN0aW9uIHJlcGxhY2UoKSB7IFtuYXRpdmUgY29kZV0gfSwsZnVuY3Rpb24gdG9TdHJpbmcoKSB7IFtuYXRpdmUgY29kZV0gfSxmdW5jdGlvbiB2YWx1ZU9mKCkgeyBbbmF0aXZlIGNvZGVdIH0=";
cookies = {
    'mz': mz,
    'sessionid':sessionid,
}

session.headers=headers

znum=0
for i in range(1,6):
    print('*' * 100)
    if i>3:headers['User-Agent']='yuanrenxue.project'

    # api/match/14/m 请求 获取保存有 v14,v142 值的混淆 js 文件
    html = session.get('https://match.yuanrenxue.com/api/match/14/m',cookies=cookies,verify=False)

    # AST 还原 获取 v14,v142 值
    with open('E:\JS\JSob\deOB\input\en.js', mode='w', encoding='utf-8') as f:
        f.write(html.text)

    os.system("node E:\JS\JSob\deOB\ob.js")
    #time.sleep(2)

    with open('E:\JS\JSob\deOB\output\de.js', mode='r', encoding='utf-8') as f:
        dedata=f.read()

    v14=re.search('window\["v14"\] = ".*?";',dedata).group(0)
    v142=re.search('window\["v142"\] = ".*?";',dedata).group(0)
    print(v14)
    print(v142)

    # 将 window['v14'],window["v142"] 加入 m.js
    njs = js.replace('jsreplace',v14+'\n'+v142+'\n')

    # 执行 m.js 获取 m 值
    mList = execjs.compile(njs).call("getm")
    #print(mList)
    #m=mList
    m=mList[i-1]
    print('m = ',m)

    # 将 m 值 添加到 cookie 中
    cookies['m']=m
    html = session.get(f'https://match.yuanrenxue.com/api/match/14?page={i}',cookies=cookies,verify=False)
    print('response: ',html.text)
    tmpdata = jsonpath.jsonpath(html.json(), '$.data..value')
    for j in tmpdata:
        znum = znum + int(j)

print('*'*100)
print('总和:',znum)

14.js

https://null119.lanzoul.com/iJtlQ04oakcb

本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习使用,请在下载后24小时内删除,严禁商用。若由于商用引起版权纠纷,一切责任均由使用者承担。 【注意:本站发布资源来源于网络搜集,均有较强时效性,请在下载前注意查看文章资源发布或更新时间,距离当前时间太久的资源不建议下载,特别是安卓专区相关资源,会有大概率失效无法使用】