一个非官方的校园菌小程序 API 文档。

欢迎

必读

1.这并不是一个官方文档,校园菌随时可能改 API 导致文档失效。

2.本文档并没有解决全部的问题,因为校园菌小程序,有一个身份密钥userkey,这个是随机生成的?(也许,我是直接通过抓包得来的,本人所用的抓包软件是ios端的thor(付费软件),所以要使用此api,你必须准备一个苹果手机,一个买了thor的苹果ID, (结尾附赠了apple id(已经购买了thor)不保证一直能用,只登陆apple store) 也正因为都是小程序,所以都是手机抓包的,自然而然相比通过浏览器来分析要少了很多数据

3.安卓支持抓包,我弄错了!

4.本文列出的代码都是基于Python的requests库, ,别问问就是只会这玩意 ,api大多都是post的提交方式,就算不传参也是 POST 请求,没想到吧。同黄学长写的湖南科技大学强智教务系统 API 文档(借鉴了学长的文档格式)

5.本人菜鸡,就随便写写,大神笑笑就行,欢迎指正

6.其实不太提倡使用校园菌的,大家可以看看学长写的强智教务系统的,校园菌的好处是功能比较多?

关于 userkey

刚刚多次尝试在抓包,发现他的 userkey 是token不是根据我们的密码来的,是每一次把它从我的小程序里面删除重新打开时服务器下发一次密钥,与微信有关,emmm,所以还是得自己抓一次包

建议就是删除小程序,然后开始抓包,重新打开,找到以下地址

https://api.jerlan.cn/pubservice/mplogin

Request

{
  "code": "xxxx1fhP300sezeJ2YVk08"这里不知道,知道了的话就不用抓包了,用抓包就不重要了
  "type": 1,
  "demo_key": ""
}

Response

{
  "code": 200,
  "msg": "登陆成功!",
  "data": {
    "user_id": 6128004,
    "uid": 628002,
    "user_name": "cdin",
    "nickname": "cdin",
    "user_ava": "https://thirdwx.qlogo.cn/mmopend/vi_32/Xnia4SicsjgOkvutvxOXod0tKiaQRuWWmnE0bh4FDVIia0mhd5F7rnUibrbhtdtBjMrRlyj3gWke5MkThetbfqEZSZ0HA/132",
    "user_sex": "男",
    "user_type": 1,
    "user_type_name": "本科生",
    "user_title": null,
    "mp_openid": "oZIks5P75rh8hCSl3sBO4sHXP3Z8",
    "xy": "计算机科学与工程学院",
    "zy": "计算机科学与技术",
    "bj": "20计算机5班",
    "name": "贺启衡",
    "xh": 2005310607,
    "qq": "",
    "tel": "18970075013",
    "openid": "ovwlZxKHsifjiU5_y5uttScmGn7KUU",
    "usertype": "_STUDEcfNT_GROUP",
    "unionid": "oliXs0wf8x1HjGZtv8A7m642P7pE4M",
    "jwcpwd": "0123123",          明文密码整无语
    "isadmin": 0,
    "isblack": 0,
    "push": 1,
    "scorepush": 1,
    "xh_noauth": null,
    "department": "",
    "position": "",
    "tel_auth": 1,
    "nj": "2020",
    "user_level": 15
  },
  "token": "eecbrd16rfd40bdb2r421rt45",     这里是最重要的,就是我们的userkey
  "SYS_PROCESS_TIME": ".2f",
  "WECHAT_LOGIN_TIME": ".2f"
}

基础

下面都是采用了此headers 包括了以下几个参数

"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.10(0x18000a27) NetType/WIFI ",

"userkey":"需要自己抓包获取",

"content-type":"application/json"    必要,没有的话是获取不到任何数据的

获取菜单(get)

地址 https://api.jerlan.cn/Userservice.main/getMpMenu

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": [
    {
      "id": 7,
      "title": "热点活动",
      "eng": "Activity",
      "functions": [
        {
          "menuid": 500,
          "icon": "cuIcon-qrcode",
          "name": "一物一码",
          "mini_name": "防丢卡贴",
          "url": "/pages/other/itemCode/itemCode",
          "type": "mini"
        },
        {
          "menuid": 503,
          "icon": "cuIcon-friend",
          "name": "拼车组队",
          "mini_name": "拼车组队",
          "url": "/pages/socializing/carpool/carpool",
          "type": "mini"
        },
        {
          "menuid": 520,
          "icon": "cuIcon-shop",
          "name": "二手市场",
          "mini_name": "二手市场",
          "url": "/pages/market/market",
          "type": "mini"
        },
        {
          "menuid": 521,
          "icon": "cuIcon-home",
          "name": "租房信息",
          "mini_name": "租房信息",
          "url": "/pages/socializing/houserent/houserent",
          "type": "mini"
        },
        {
          "menuid": 524,
          "icon": "cuIcon-deliver",
          "name": "机场大巴",
          "mini_name": "机场大巴",
          "url": "/pages/other/ticket/ticket",
          "type": "mini"
        },
        {
          "menuid": 130,
          "icon": "cuIcon-redpacket",
          "name": "吃喝玩乐",
          "mini_name": "吃喝玩乐",
          "url": "wx8262ee5b43cd92e1",
          "type": "otherMini"
        }
      ]
    },
    {
      "id": 5,
      "title": "学习在科大",
      "eng": "Study",
      "functions": [
        {
          "menuid": 155,
          "icon": "cuIcon-calendar",
          "name": "我的课表",
          "mini_name": "我的课表",
          "url": "/pages/xyj/kebiao/kebiao",
          "type": "mini"
        },
        {
          "menuid": 160,
          "icon": "cuIcon-rank",
          "name": "考试成绩",
          "mini_name": "考试成绩",
          "url": "/pages/xyj/grade/grade",
          "type": "mini"
        },
       仅列举部分
      ]
    }
  ]
}

获取天气

地址 https://api.jerlan.cn/userservice.main/getWeather?city=%E6%B9%98%E6%BD%AD

city= 后可以自己加(我一看这个我就觉得他是抄的中华万年历的接口,无语)

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "data": {
      "yesterday": {
        "date": "16日星期一",
        "high": "高温 32℃",
        "fx": "西南风",
        "low": "低温 25℃",
        "fl": "<![CDATA[1级]]>",
        "type": "小雨"
      },
      "city": "湘潭",
      "forecast": [
        {
          "date": "17日星期二",
          "high": "高温 32℃",
          "fengli": "<![CDATA[1级]]>",
          "low": "低温 24℃",
          "fengxiang": "东南风",
          "type": "小雨"
        },
        {
          "date": "18日星期三",
          "high": "高温 31℃",
          "fengli": "<![CDATA[1级]]>",
          "low": "低温 25℃",
          "fengxiang": "西北风",
          "type": "小雨"
        },
        {
          "date": "19日星期四",
          "high": "高温 33℃",
          "fengli": "<![CDATA[1级]]>",
          "low": "低温 27℃",
          "fengxiang": "南风",
          "type": "阴"
        },
        {
          "date": "20日星期五",
          "high": "高温 36℃",
          "fengli": "<![CDATA[2级]]>",
          "low": "低温 27℃",
          "fengxiang": "南风",
          "type": "阴"
        },
        {
          "date": "21日星期六",
          "high": "高温 33℃",
          "fengli": "<![CDATA[2级]]>",
          "low": "低温 27℃",
          "fengxiang": "南风",
          "type": "阴"
        }
      ],
      "ganmao": "感冒低发期,天气舒适,请注意多吃蔬菜水果,多喝水哦。",
      "wendu": "26"
    },
    "status": 1000,
    "desc": "OK"
  }
}

获取学期数

地址 https://api.jerlan.cn/Jwservice.Timetable/getXqList

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "xqlist": [
      {
        "id": 2,
        "name": "2018-2019-2(下学期)",
        "xq": "2018-2019-2",
        "st": "2019-02-25",
        "disable": "2",
        "preg": "20182019",
        "admin_ctrl": null
      },
      {
        "id": 3,
        "name": "2019-2020-1(上学期)",
        "xq": "2019-2020-1",
        "st": "2019-09-02",
        "disable": "2",
        "preg": "20192020",
        "admin_ctrl": null
      },
      {
        "id": 4,
        "name": "2019-2020-2(下学期)",
        "xq": "2019-2020-2",
        "st": "2020-02-24",
        "disable": "2",
        "preg": "20192020",
        "admin_ctrl": ""
      },
      {
        "id": 5,
        "name": "2020-2021-1(上半学期)",
        "xq": "2020-2021-1",
        "st": "2020-09-07",
        "disable": "2",
        "preg": "20202021",
        "admin_ctrl": ""
      },
      {
        "id": 6,
        "name": "2020-2021-2(下半学期)",
        "xq": "2020-2021-2",
        "st": "2021-03-01",
        "disable": "2",
        "preg": "20202021",
        "admin_ctrl": null
      },
      {
        "id": 7,
        "name": "2021-2022-1(上半学期)",
        "xq": "2021-2022-1",
        "st": "2021-09-06",
        "disable": "2",
        "preg": "20212022",
        "admin_ctrl": null
      }
    ],
    "xq": 7,            学期 不太清楚,下面要用
    "xqstring": "2021-2022-1",
    "nextXqInfo": {
      "id": 7,
      "name": "2021-2022-1(上半学期)",
      "xq": "2021-2022-1",
      "st": "2021-09-06",
      "disable": "2",
      "preg": "20212022",
      "admin_ctrl": null
    },
    "week": 0
  }
}

获取本学期上课时间安排

地址 https://api.jerlan.cn/Jwservice.Timetable/getCurrentInfo

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "xq": 7,
    "xqstring": "2021-2022-1", 学期
    "week": 0,
    "xqInfo": {
      "id": 7,
      "name": "2021-2022-1(上半学期)",
      "xq": "2021-2022-1",
      "st": "2021-09-06",   开始上课
      "disable": "2",
      "preg": "20212022",
      "admin_ctrl": null
    },
    "isSummer": 1,
    "lessonTime": {   上课时间,下面要用
      "1": "8:00",
      "2": "9:40",
      "3": "10:00",
      "4": "11:40",
      "5": "14:30",
      "6": "16:10",
      "7": "16:30",
      "8": "18:10",
      "9": "19:30",
      "10": "21:10"
    }
  }
}

获取本学期课程表

地址 https://api.jerlan.cn/Jwservice.Timetable/getByWeek

Request

"xh": "2005010607",    学号  //改学号也可以用来获取公共课表
"week": "1",           周数
"xq": "7"              学期 看上面

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "nowWeekClass": [
      {
        "kcid": "202120221009731",  课程id
        "title": "概率论与数理统计B",
        "class": "20计算机[5-8]班",
        "people": "114位同学",
        "classroom": "第一教学楼105",
        "teacher": "彭丹",
        "day": "5",       
注意一下,他这里的课程并不是按照时间顺序来排的
貌似是随机的,这边day表示的是星期,如果要按星期来排的话,需要自己判断一下
        "start": 3,    开始节数
        "end": "4",    结束节数
        "xh": 2005010607,  
        "week": "1-14",
        "key": ""
      },
      {
        "kcid": "202120221002212",
        "title": "计算机组成原理",
        "class": "20计算机[5-8]班",
        "people": "114位同学",
        "classroom": "第一教学楼305",
        "teacher": "黄卫红",
        "day": "5",
        "start": 5,
        "end": "6",
        "xh": 2005010607,
        "week": "1-4",
        "key": ""
      },
      {
        "kcid": "202120221002194"a,
        "title": "马克思主义基本原理概论",
        "class": "20计算机[1-6]班",
        "people": "177位同学",
        "classroom": "第一教学楼103",
        "teacher": "吴晓蓉",
        "day": "1",
        "start": 5,
        "end": "6",
        "xh": 2005010607,
        "week": "1-14",
        "key": ""
      }
    ],
    "xq": 7,  
    "xqstring": "2021-2022-1",
    "curweek": 3
  }
}

获取公共课程表

地址 https://api.jerlan.cn/Jwservice.Timetable/getUserKbByWeek

Request

"xh": "2005010607",    学号  
"week": "1",           周数
"xq": "7"              学期 看上面现在是第几学期?

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "nowWeekClass": [
      {
        "kcid": "202120221009731",  课程id
        "title": "概率论与数理统计B",
        "class": "20计算机[5-8]班",
        "people": "114位同学",
        "classroom": "第一教学楼105",
        "teacher": "彭丹",
        "day": "5",       
注意一下,他这里的课程并不是按照时间顺序来排的
貌似是随机的,这边day表示的是星期,如果要按星期来排的话,需要自己判断一下
        "start": 3,    开始节数
        "end": "4",    结束节数
        "xh": 2005010607,  
        "week": "1-14",
        "key": ""
      },
      {
        "kcid": "202120221002212",
        "title": "计算机组成原理",
        "class": "20计算机[5-8]班",
        "people": "114位同学",
        "classroom": "第一教学楼305",
        "teacher": "黄卫红",
        "day": "5",
        "start": 5,
        "end": "6",
        "xh": 2005010607,
        "week": "1-4",
        "key": ""
      },
      {
        "kcid": "202120221002194"a,
        "title": "马克思主义基本原理概论",
        "class": "20计算机[1-6]班",
        "people": "177位同学",
        "classroom": "第一教学楼103",
        "teacher": "吴晓蓉",
        "day": "1",
        "start": 5,
        "end": "6",
        "xh": 2005010607,
        "week": "1-14",
        "key": ""
      }
    ],
    "xq": 7,  
    "xqstring": "2021-2022-1",
    "curweek": 3
  }
}

获取饭卡信息 1

地址 https://api.jerlan.cn/Stuservice.card/stat

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "sumCharge": "0.00", 本月充值
    "sumCost": "0.00",   本月消费
    "balance": "3.32"    饭卡剩余,没错,我饭卡里面就只有3块3毛2了
  }
}

获取饭卡信息 2

地址 https://api.jerlan.cn/Stuservice.card/getBalance

Request

{
  "disableCache": 1
}

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "name": "贺启衡",   姓名
    "cardId": "110847", 饭卡id
    "balance": "3.32",  饭卡剩余,没错,我饭卡里面就只有3块3毛2了
    "status": "正常",   饭卡状态
    "time": 1629139091
  }
}

获取饭卡信息 3

地址 https://api.jerlan.cn/Stuservice.card/getRecord

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": [
    {
      "time": "07-05 07:40",  饭卡消费记录
      "type": "持卡人消费",
      "system": "商务子系统",
      "trade": "-2.00",
      "balance": "57.74",
      "count": "1295", 总共使用次数
      "status": "正常"
    },
    {
      "time": "07-05 07:39",
      "type": "持卡人消费",
      "system": "商务子系统",
      "trade": "-3.00",
      "balance": "59.74",
      "count": "1294",
      "status": "正常"
    },
    {
      "time": "07-02 17:50",
      "type": "持卡人消费",
      "system": "第三方对接子系统",
      "trade": "-2.00",
      "balance": "62.74",
      "count": "1293",
      "status": "正常"
    },
    {
      "time": "07-01 18:13",
      "type": "持卡人消费",
      "system": "商务子系统",
      "trade": "-1.80",
      "balance": "64.74",
      "count": "1292",
      "status": "正常"
    },
仅列举部分
  ]
}

其实还有一个挂失和解挂,但是我刚刚用的时候是用不了,所以暂时还没法列举api

获取成绩

地址 https://api.jerlan.cn/Jwservice.score/getall

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": {
    "data": [
      {
        "score": {
          "zc": [
            {
              "xq": "2020-2021-1",        学期
              "kcid": "2000002030",
              "kc": "思想道德修养与法律基础",
              "cj": "xx",                 成绩
              "xz": "公共基础课",
              "lb": "必修",
              "xf": "xx",                 学分
              "jd": "xx",                 绩点
              "cjbs": "",
              "bcxq": "",
              "khfs": "考试",             考试方式
              "ksxz": "正常考试",
              "zxs": "48"                 不知道
            },
          ],
          "ts": [],
          "cx": []
        },
        "info": {
          "pjxfjd": xxx,绩点
          "gknum": 0,
          "gkbfb": 100,     及格率
          "num": 10,
          "xq": "2020-2021-1"
        }
      },
      {
        "score": {
          "zc": [
            {
下一学期的,省略
      }
    ],
    "info": {
      "pjxf": "xx",    平均绩点
      "gkbfb": xx,      及格率
      "name": "贺启衡",
      "xh": 2005010607,
      "gknum": x,     挂科门数
      "fromtype": "Online"
    }
  }
}

获取借阅图书信息

由于我从来没有去图书馆借过书,所以这一部分的话,没法补充,仅列出几个网址,大家借过书的可以自己看一下

地址 https://api.jerlan.cn/Stuservice.book/getLoanList

https://api.jerlan.cn/Stuservice.book/getCollect

Request

Response

{
  "code": 200,
  "msg": "ok",
  "data": []

其实重点是这一个网址,我是没怎么看得懂,有大佬看得懂的话麻烦解释一下

http://59.36.89.185:8080/?tk=d416355a1b6725014fd1fd97099c5bfb865b3a6f257fbed2e1a5b2377135fec8323f6e7f03b881db21133b1bf2ae5bc5

手机评教,考试安排,选课暂时因为不能使用,所以没写,等待后面有机会补充。

PS 附上样例代码

查课程表
import json

import requests

header = {"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.10(0x18000a27) NetType/WIFI ",
           "userkey":"xx换成自己的",
          "content-type":"application/json"}
url = 'https://api.jerlan.cn/Jwservice.Timetable/getByWeek'
s = json.dumps({
  "xh": "2005010407",
  "week": "1",
  "xq": "7"
})
r = requests.post(url,headers=header, data=s)
print(r.json())

最后在附赠apple id(已经购买了thor)

账号

[email protected]

密码

https://t.me/AppleIDShared?2

END

届ける言葉を今は育ててる
最后更新于 2023-05-30