如何获取传智教育高校教辅平台的题库中的所有题目信息

本文介绍了如何通过F12开发者工具抓取传智教育题库API的题目信息,包括步骤、示例Python代码以及如何解析JSON数据以获取不同类型题目和答案。
摘要由CSDN通过智能技术生成

如何获取传智教育高校教辅平台的题库中的所有题目信息

  • 如何获取题库API接口
    1,打开系统题库,如https://tch.ityxb.com/teaching/141bf4f969044ae3890d99cc15246353/questionBank/list?sys=1
    2,按 F12 键, 选择 Network
    选项卡,刷新页面,找到接口请求,如https://tch.ityxb.com/back/bxg/question/queryQuestion?pageSize=20&pageNumber=1&point=&searchType=1&questionContent=&textbook=141bf4f969044ae3890d99cc15246353&chapter=&questionType=&difficulty=&question_content=&t=1712745681047,复制该接口地址。
    3,复制 URL, 打开浏览器,输入该地址,按回车键,即可看到题目信息。将 pageSize 改为 10000
    或大一些,可以获取更多题目信息。 4,将获取到的题目信息保存到本地,如test.json 文件。 5,使用 Python 脚本读取
    test.json 文件,获取题目信息。

import json

# 0-单选
# 1-多选
# 2-判断
# 3-填空
# 4-简答
# 题型-questionType
# 难度-difficulty
# 题目-questionContent
# 选项-options
# 答案-answer

```python
with open('test.json', 'r', encoding='utf-8') as file:
    data = json.load(file)
    dtype = {"0": "单选", "1": "多选", "2": "判断", "3": "填空", "4": "简答"}
    res_str = ""
    for i in range(len(data['data']['records'])):

        print(i, end="##")
        print(dtype[data['data']['records'][i]['questionType']], end="##")
        print(data['data']['records'][i]['difficulty'], end="##")

        print(data['data']['records'][i]['questionContent'], end="##")
        if data['data']['records'][i]['questionType'] in "01":
            print(data['data']['records'][i]['options'],  end="##")
        print(data['data']['records'][i]['answer'],  end="\n")

        res_str += (str(i) + "##" + dtype[data['data']['records'][i]['questionType']] + "##" + data['data']['records'][i]['difficulty'] +
                    "##" + data['data']['records'][i]['questionContent'] + "##" + data['data']['records'][i]['answer'] + "\n")
open('Linux_题库.txt', 'w', encoding='utf-8').write(res_str)

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值