前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >大学生在线四史脚本

大学生在线四史脚本

作者头像
全栈程序员站长
发布2022-07-02 11:03:22
4880
发布2022-07-02 11:03:22
举报

大家好,又见面了,我是你们的朋友全栈君。

大学生在线四史脚本

有Python环境

编译环境

一、编译环境:Python 3.0 二、依赖库 本项目依赖的第三方库:

代码语言:javascript
复制
requests

在终端执行以下语句安装依赖即可:

代码语言:javascript
复制
pip install requests

使用方法 运行后直接输入token或uid即可,程序会自动识别。 ⚠️ ️注意: ️输入token为Bearer后面那一串英文,一定要复制完全! 有Python环境 将题库.csv与main.py放于同一目录下,直接运行main.py文件即可.

无Python环境 下载可执行文件,将题库.csv与main.exe置于同一文件夹,直接运行即可.

源码分享

main.py

代码语言:javascript
复制
import requests,csv,re,json,random,time
mode_id_list = [
    { 
   "id": "5f71e934bcdbf3a8c3ba51d5", "name": "英雄篇"},
    { 
   "id": "5f71e934bcdbf3a8c3ba51d6", "name": "复兴篇"},
    { 
   "id": "5f71e934bcdbf3a8c3ba51d7", "name": "创新篇"},
    { 
   "id": "5f71e934bcdbf3a8c3ba51d8", "name": "信念篇"},
]
#篇文id
Mode_id = '5f71e934bcdbf3a8c3ba51d5'
#篇文名字
name = '英雄篇'
#记录刷的积分
Integrals = 0

#获取选择的四史篇目
def GetMode_id(type = 8):
    global Mode_id
    global name
    if type == 1:
        json = mode_id_list[type-1]
    elif type == 2:
        json = mode_id_list[type-1]
    elif type == 3:
        json = mode_id_list[type-1]
    elif type == 4:
        json = mode_id_list[type-1]
    else:
        json = mode_id_list[random.randint(0,3)]
    Mode_id = json["id"]
    name = json["name"]
    #print(Mode_id)
    #print(name)
    #return json

#获取个人信息
def GetInfo():
    import requests

    url = "https://ssxx.univs.cn/cgi-bin/race/grade/?t=1612856369&activity_id=5f71e934bcdbf3a8c3ba5061"

    payload = { 
   }
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s' % (token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a; _gat=1'
    }
    #设置代理ip
    #proxies = {'http': '120.236.128.201:8060','https': '120.236.128.201:8060'}
    #proxies = random.choice(proxies)
    #print("选择的代理ip为%s"%(proxies))
    #response = requests.request("GET", url, proxies=proxies, headers=headers, data=payload)
    response = requests.request("GET", url, headers=headers, data=payload)

    return response.json()


#获取登录二维码 -已失效
def ViewQR(url=''):
    html = requests.get(url)
    with open('QR.png', 'wb') as file:
        file.write(html.content)

    import platform
    userPlatform=platform.system()						# 获取操作系统
    fileDir='QR.png'

    if userPlatform == 'Darwin':								# Mac
        import subprocess
        subprocess.call(['open', fileDir])
    elif userPlatform == 'Linux':								# Linux
        import subprocess
        subprocess.call(['xdg-open', fileDir])
    else:																# Windows
        import os
        os.startfile(fileDir)


#读取题库
def ReadFile():
    with open("题库.csv", "r",encoding='UTF-8') as f:
        reader = csv.reader(f)
        db = []
        for row in list(reader):
            db.append(row)
    return db


#写入题库
def IntoFile(FileNmae = '题库.csv',Data=[]):
    file = open(FileNmae, 'a', encoding='utf-8',newline='')
    f = csv.writer(file)
    f.writerow(
        Data
    )
    print('已写入%s文件:'%(FileNmae),Data)
    file.close()


#获取题目
def GetQuestions(activity_id='5f71e934bcdbf3a8c3ba5061'):
    global Mode_id

    url = "https://ssxx.univs.cn/cgi-bin/race/beginning/?t=1612247769&activity_id=%s&mode_id=%s&way=1"%(activity_id,Mode_id)

    payload = { 
   }
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a; _gat=1'
    }

    response = requests.request("GET", url, headers=headers, data=payload)

    # print('获取题目:',response.json())
    question_ids = response.json()['question_ids']
    num = 0
    SucessNum = 0
    FailNum = 0
    for i in range(len(question_ids)):
        num += 1
        if i == 10:
            if CheckVerification():
                print("验证码已通过")
            else:
                SubmitVerification()
                print("验证码状态:", CheckVerification())
        if GetOption(activity_id=activity_id,question_id=question_ids[i]):
            SucessNum += 1
        else:
            FailNum += 1
    race_code = response.json()['race_code']
    Finsh(race_code)
    print('此次成功查询%s个题,收录%s个题'%(SucessNum,FailNum))


#获取选项
def GetOption(activity_id='5f71e934bcdbf3a8c3ba5061',question_id='5f17ef305d6fe02504ba5e17'):
    global Mode_id
    url = "https://ssxx.univs.cn/cgi-bin/race/question/?t=1612247250&activity_id=%s&question_id=%s&mode_id=%s&way=1"%(activity_id,question_id,Mode_id)

    payload = { 
   }
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a'
    }

    response = requests.request("GET", url, headers=headers, data=payload)

    # print('获取选项:',response.json())

    options = response.json()['data']['options']
    #选项
    result = { 
   }
    for i in options:
        title = i['title']
        replace1 = re.findall('<.*?>', title)
        for j in range(len(replace1)):
            if 'display:none;' in replace1[j] or 'display: none;' in replace1[j]:
                replace2 = re.findall('%s.*?%s' % (replace1[j], replace1[j + 1]), title)
                title = str(title).replace(replace2[0], '')
        for j in replace1:
            title = str(title).replace(j, '')
        result[title] = i['id']
    # print(result)

    #题目
    title = response.json()['data']['title']
    replace1 = re.findall('<.*?>',title)
    for i in range(len(replace1)):
        if 'display:none;' in replace1[i] or 'display: none;' in replace1[i]:
            replace2 = re.findall('%s.*?%s'%(replace1[i],replace1[i+1]),title)
            title = str(title).replace(replace2[0],'')
    for i in replace1:
        title = str(title).replace(i,'')
    # print(title)

    '''判断题目是否已在题库中'''
    db = ReadFile()
    for i in db:
        if not i:
            continue
        #在题库中
        if title in i[0]:
            print('在题库中已搜索到答案: %s - %s'%(i[0],i[1]))
            answer = []
            for j,k in result.items():
                if j in i[1]:
                    answer.append(k)
            #提交答案
            Confire(question_id=question_id,answer=answer)
            return 'Sucess'
    #题库中没有
    print('未在题库中搜索到答案,执行捕获题目模式...')
    results = SreachResult(question_id=question_id, answer=response.json()['data']['options'][0]['id'])
    TrueResult = []
    for i in results:
        for j,k in result.items():
            if i == k:
                TrueResult.append(j)
    num = 0
    for i in db:
        if title in i:
            num += 1
            break
    if not num:
        IntoFile(FileNmae = '题库.csv',Data=[title,TrueResult])
    else:
        print('已存在题库中: ',title[0],TrueResult)


#从题库中搜素答案
def SreachResult(question_id='5f17ef305d6fe02504ba5e17',answer='5f75fe348e6c9f85d1b6072a',activity_id='5f71e934bcdbf3a8c3ba5061'):
    global Mode_id
    url = "https://ssxx.univs.cn/cgi-bin/race/answer/"

    payload = "{\"activity_id\":\"%s\",\"question_id\":\"%s\",\"answer\":[\"%s\"],\"mode_id\":\"%s\",\"way\":\"1\"}"%(activity_id,question_id,answer,Mode_id)
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'content-type': 'application/json;charset=UTF-8',
        'origin': 'https://ssxx.univs.cn',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a'
    }
    #答题完成一次休眠时间
    #time.sleep(random.uniform(0.1,0.3))#0.1 0.3
    response = requests.request("POST", url, headers=headers, data=payload)

    data = response.json()
    # print('提交选项:',data)
    return response.json()['data']['correct_ids']


#提交题目选项
def Confire(question_id='5f17ef305d6fe02504ba5e17',answer=['5f75fe348e6c9f85d1b6072a'],activity_id='5f71e934bcdbf3a8c3ba5061'):
    global Mode_id
    url = "https://ssxx.univs.cn/cgi-bin/race/answer/"

    payload = '{"activity_id":"%s","question_id":"%s","answer":%s,"mode_id":"%s","way":"1"}'%(activity_id,question_id,json.dumps(answer),Mode_id)


    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'content-type': 'application/json;charset=UTF-8',
        'origin': 'https://ssxx.univs.cn',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a'
    }
    #答题完成一次休眠时间
    #time.sleep(random.uniform(0.1,0.3))#0.1 0.3
    response = requests.request("POST", url, headers=headers, data=payload)

    data = response.json()
    # print('提交选项:', data)
    # print(data)
    return response.json()['data']['correct_ids']


#提交整个试题
def Finsh(race_code='6018f697224c6a1526204144'):

    url = "https://ssxx.univs.cn/cgi-bin/race/finish/"

    payload = "{\"race_code\":\"%s\"}"%(race_code)
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'content-type': 'application/json;charset=UTF-8',
        'origin': 'https://ssxx.univs.cn',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a'
    }

    response = requests.request("POST", url, headers=headers, data=payload)
    # print('提交:',response.json())

    if response.json()['code'] == 4823:
        SubmitVerification()
        Finsh(race_code)
    # print(response.json())
    try:
        print('已提交,正确数:%s 用时:%ss'%(response.json()['data']['owner']['correct_amount'],response.json()['data']['owner']['consume_time']))
        global Integrals
        Integrals = int(response.json()['data']['owner']['correct_amount'])
    except:
        print(response.json())


#PK10 -已废弃,暂不更新
def PK10(activity_id='5f71e934bcdbf3a8c3ba5061',mode_id='5f71e934bcdbf3a8c3ba51da'):
    import requests

    url = "https://ssxx.univs.cn/cgi-bin/race/beginning/?t=1612260314&activity_id=%s&mode_id=%s&way=1"%(activity_id,mode_id)

    payload = { 
   }
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s'%(token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/3/1/5f71e934bcdbf3a8c3ba51da',
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=09fcb686b72bcf8a19fb9f044a5a52d5; _gat=1'
    }

    response = requests.request("GET", url, headers=headers, data=payload)

    # print(response.json())

    question_ids = response.json()['question_ids']
    num = 0
    SucessNum = 0
    FailNum = 0
    for i in question_ids:
        num += 1
        if GetOption(activity_id=activity_id, question_id=i, mode_id=mode_id):
            SucessNum += 1
        else:
            FailNum += 1
    race_code = response.json()['race_code']
    Finsh(race_code)
    print('此次成功查询%s个题,收录%s个题' % (SucessNum, FailNum))


#登录函数 -已失效
def Login():
    print('正在获取登陆二维码...')
    Random = ''.join(random.sample('qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890',random.randrange(5,10)))
    url = 'https://oauth.u.hep.com.cn/oauth/wxapp/qrcode/5f582dd3683c2e0ae3aaacee?random=%s&useSelfWxapp=true&enableFetchPhone=false'%(Random)
    a = requests.get(url)
    print("请用微信扫描二维码登陆...")
    ViewQR(a.json()['data']['qrcode'])
    print('\r正在等待扫描二维码...',end='\r')
    time.sleep(3)
    TimeNum = 1
    while True:
        print('\r正在等待扫描二维码,已等待%ss...'%(TimeNum),end='')
        a = requests.post('https://oauth.u.hep.com.cn/oauth/wxapp/confirm/qr?random=%s&useSelfWxapp=true'%(Random))
        if a.json()['data']['code'] == 200:
            _id = a.json()['data']['data']['_id']
            print('\n欢迎你,%s'%(a.json()['data']['data']['username']))
            GetToken(uid=_id)
            break
        time.sleep(1)
        print('\r',end='')
        TimeNum += 1


#获取token
def GetToken(uid='6018e5d37fc77f3d90194078'):
    url = 'https://ssxx.univs.cn/cgi-bin/authorize/token/?t=1612276118&uid=%s'%(uid)
    a = requests.get(url=url)
    global token
    token = a.json()['token']
    # print(token)
    return token


#检查验证信息
def CheckVerification():
    global  Mode_id
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s' % (token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a; _gat=1'
    }
    code = "E5ZKeoD8xezW4TVEn20JVHPFVJkBIfPg+zvMGW+kx1s29cUNFfNka1+1Fr7lUWsyUQhjiZXHDcUhbOYJLK4rS5MflFUvwSwd1B+1kul06t1z9x0mfxQZYggbnrJe3PKEk4etwG/rm3s3FFJd/EbFSdanfslt41aULzJzSIJ/HWI="
    submit_data = { 
   
        "activity_id": "5f71e934bcdbf3a8c3ba5061",
        "mode_id": Mode_id,
        "way": "1",
        "code": code
    }
    url = "https://ssxx.univs.cn/cgi-bin/check/verification/code/"
    response = requests.post(url, json=submit_data, headers=headers)
    result = json.loads(response.text)
    # print(result)
    return result["status"]


#提交验证
def SubmitVerification():
    global Mode_id
    headers = { 
   
        'authority': 'ssxx.univs.cn',
        'sec-ch-ua': '"Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"',
        'accept': 'application/json, text/plain, */*',
        'authorization': 'Bearer %s' % (token),
        'sec-ch-ua-mobile': '?0',
        'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36',
        'sec-fetch-site': 'same-origin',
        'sec-fetch-mode': 'cors',
        'sec-fetch-dest': 'empty',
        'referer': 'https://ssxx.univs.cn/client/exam/5f71e934bcdbf3a8c3ba5061/1/1/%s'%(Mode_id),
        'accept-language': 'zh,en;q=0.9,zh-CN;q=0.8',
        'cookie': '_ga=GA1.2.79005828.1612243540; _gid=GA1.2.1602430105.1612243540; tgw_l7_route=be2f17e6fbcb3e6c5202ac57e388ad5a; _gat=1'
    }
    code = "HD1bhUGI4d/FhRfIX4m972tZ0g3jRHIwH23ajyre9m1Jxyw4CQ1bMKeIG5T/voFOsKLmnazWkPe6yBbr+juVcMkPwqyafu4JCDePPsVEbVSjLt8OsiMgjloG1fPKANShQCHAX6BwpK33pEe8jSx55l3Ruz/HfcSjDLEHCATdKs4="
    submit_data = { 
   
        "activity_id": "5f71e934bcdbf3a8c3ba5061",
        "mode_id": Mode_id,
        "way": "1",
        "code": code
    }
    url = "https://ssxx.univs.cn/cgi-bin/save/verification/code/"
    response = requests.post(url, json=submit_data, headers=headers)
    result = response.json()
    # print(result)
    # if result["code"] != 0:
    # pass
        # raise MyError(result["code"], "提交验证码失败:" + str(result))
    # return result["status"]

# token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MTU4MjU3ODgsImlhdCI6MTYxNTgxNDk4OCwiaXNzIjoiSEVQRTM6QVVUSCIsIm5iZiI6MTYxNTgxNDk4OCwidWlkIjoiNjAxOTQyNjhkMGI2MGI1Nzg4MWU5MjJjIiwibmFtZSI6Ilx1N2M3M1x1OWE2Y1x1Njc5NyIsImNvZGUiOiI2MDE5NDI2OGQwYjYwYjU3ODgxZTkyMmMiLCJpc19wZXJmZWN0Ijp0cnVlfQ.7ehyVRuorstSzZBzAE7Imdgoa_gVmDAS31Wj90l24eI'



loginInfo = input('请输入uid或者token「不含Bearer,即后面那一串内容.」\n输入完成后回车:')

judge = True
GetMode_id()
if len(loginInfo) > 200:
    print('已更新token,正在获取信息...')
    token = loginInfo
else:
    uid = loginInfo
    print('正在获取token,请稍后...')
    try:
        token = GetToken(uid=uid)
    except:
        judge = False
        print('uid输入有误或网络问题...')
    print('token已更新...')

info = GetInfo()
try:
    info = GetInfo()['data']
except:
    judge = False
    print('输入token有误或登录已过期...')
if judge:

    print('欢迎你,来自%s的%s,当前积分:%s'%(info['university_name'],info['name'],info['integral']))
    print('自动选择------------>8\n'+'英雄篇---------->1\n'+'复兴篇---------->2\n'+'创新篇---------->3\n'+'信念篇---------->4')
    type = int(input("请选择模式: "))
    EndNum = int(input("请输入需要刷的积分: "))
    num = 0
    IntegralSum = 0
    #while num < EndNum:
    while IntegralSum <= EndNum:
        GetMode_id(type)
        info = GetInfo()['data']
        print('当前答题篇目:',name)
        print('当前积分:',info['integral'])
        num += 1
        print('\n正在第%s次刷题~,已刷%s积分'%(num,IntegralSum))
        GetQuestions()
        IntegralSum += Integrals

    info = GetInfo()['data']
    print('\n感谢使用!来自%s的%s,当前积分:%s,本次刷题积分为:%s'%(info['university_name'],info['name'],info['integral'],IntegralSum))
input('感谢使用,回车退出程序:)')

2、题录.csv 下载

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/147533.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 大学生在线四史脚本
  • 有Python环境
    • 编译环境
      • 源码分享
相关产品与服务
验证码
腾讯云新一代行为验证码(Captcha),基于十道安全栅栏, 为网页、App、小程序开发者打造立体、全面的人机验证。最大程度保护注册登录、活动秒杀、点赞发帖、数据保护等各大场景下业务安全的同时,提供更精细化的用户体验。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档