智慧职教云,云课堂,刷课,签到,查作业考试答案软件,手机刷课软件,职教云刷课[记一次软件开发经历],职教云刷课脚本开源!

因为疫情我们被迫在家学习。上网课看课件就很烦人,于是就想写一个软件能帮助我看课件,解放我的双手

项目构思

本来是用python做的电脑端但是由于电脑携带不方便所以就想开发一个app在手机上面也能刷课
说干就干
先构思本来打算全部工作都由前端来完成,不用服务端的,后来发现有些东西前端写着太麻烦了于是就有了现在这个样子

使用php做后端开发api
使用java做前端开发

经过几个月的开发现在他已经变得非常完善

具体功能有
1.题库考试 答案查询
2.职教云刷课 包括评论、 纠错、问答
3.职教云mooc刷课(仅课件)
4.免密码签到
5.头脑风暴 讨论同学答案查询
可以体验一下

下载地址:https://lanzous.com/b00tku0te

智慧职教云,云课堂,刷课,签到,查作业考试答案软件,手机刷课软件,职教云刷课[记一次软件开发经历],职教云刷课脚本开源!_第1张图片
智慧职教云,云课堂,刷课,签到,查作业考试答案软件,手机刷课软件,职教云刷课[记一次软件开发经历],职教云刷课脚本开源!_第2张图片
智慧职教云,云课堂,刷课,签到,查作业考试答案软件,手机刷课软件,职教云刷课[记一次软件开发经历],职教云刷课脚本开源!_第3张图片
智慧职教云,云课堂,刷课,签到,查作业考试答案软件,手机刷课软件,职教云刷课[记一次软件开发经历],职教云刷课脚本开源!_第4张图片

python职教云刷课开源

import requests
import json
import time
import random
from urllib import parse

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36',
}


def logo():
    """
    登录
    :return:返回(0)登录用户信息   返回(1)cookies
    """
    url = "https://zjyapp.icve.com.cn/newmobileapi/mobilelogin/newlogin"
    data = {
        'userName': input("请输入用户名:"),  #
        'userPwd': input("请输入密码:"),  #
        'verifyCode': '',
    }
    try:
        r = requests.post(url=url, headers=headers, data=data)
        r.raise_for_status()
        r.encoding = r.apparent_encoding
        cookie = requests.utils.dict_from_cookiejar(r.cookies)
        print(r.text)
        print(cookie)
        return r.text, cookie
    except:
        return '操作异常'


def logostuSign(StuId, OpenClassId, SignId):
    data = {
        'data': "{'SignResultType': 1, 'StuId': '" + StuId + "', 'OpenClassId': '" + OpenClassId + "', 'SignId': '" + SignId + "', 'Id': '" + StuId + "', 'SourceType': 3}",
        'sourceType': 3
    }
    print(data)
    url = "https://zjyapp.icve.com.cn/newMobileAPI/FaceTeach/changeSignType"
    try:
        r = requests.post(url=url, headers=headers, data=data)
        print(r.text)
        return r.text
    except:
        return '签到异常'


def getcourse(cookies):
    """
    获取课程列表
    :param cookies:
    :return: json
    """
    url = "https://zjy2.icve.com.cn/api/student/learning/getLearnningCourseList"
    try:
        r = requests.post(url=url, headers=headers, cookies=cookies)
        print(r.text)
        return r.text
    except:
        return '获取课程操作异常'


def getunit(cookies, courseOpenId, openClassId):
    """
    获取单元信息
    :param cookies:
    :param courseOpenId:课程ID
    :param openClassId:
    :return:
    """
    url = "https://zjy2.icve.com.cn/api/study/process/getProcessList"
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
    }

    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        return r.text
    except:
        return '获取单元操作异常'


def getsection(cookies, courseOpenId, moduleId):
    """
    获取章节ID
    :param cookies:
    :param courseOpenId:课程ID
    :param moduleId: 单元ID
    :return: json
    """

    url = "https://zjy2.icve.com.cn/api/study/process/getTopicByModuleId"
    data = {
        "courseOpenId": courseOpenId,
        "moduleId": moduleId,
    }

    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        return r.text
    except:
        return '获取章节操作异常'


def getclassinfo(cookies, courseOpenId, openClassId, topicId):
    url = "https://zjy2.icve.com.cn/api/study/process/getCellByTopicId"
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "topicId": topicId,
    }

    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        return r.text
    except:
        return '获取节课操作异常'


def getvideo(cookies, courseOpenId, openClassId, cellId, moduleId):
    url = "https://zjy2.icve.com.cn/api/common/Directory/viewDirectory"
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "cellId": cellId,
        "flag": "s",
        "moduleId": moduleId,
    }
    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        return r.text
    except:
        return '获取视频详细信息操作异常'


def videodispose(cookies, courseOpenId, openClassId, cellId, token, videoTimeTotalLong):
    """
    处理视频
    :param cookies:
    :param courseOpenId:
    :param openClassId:
    :param cellId:
    :param token:
    :param videoTimeTotalLong: 视频长度
    :return:
    """
    url = "https://zjy2.icve.com.cn/api/common/Directory/stuProcessCellLog"
    for i in range(20, int(videoTimeTotalLong), 20):
        i = i + random.choice([0.134831, 0.234831, 0.334831, 0.434831, 0.534831, 0.634831])
        data = {
            "courseOpenId": courseOpenId,
            "openClassId": openClassId,
            "cellId": cellId,
            "cellLogId": "",
            "picNum": 0,
            "studyNewlyTime": i,
            "studyNewlyPicNum": 0,
            "token": token
        }
        # print(data)
        try:
            r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
            print(r.text)
            print("正在处理中...")
            time.sleep(16)
        except:
            print("提交视频进度异常!")
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "cellId": cellId,
        "cellLogId": "",
        "picNum": 0,
        "studyNewlyTime": videoTimeTotalLong,
        "studyNewlyPicNum": 0,
        "token": token
    }
    # print(data)

    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        print("提交视频成功")
        print(r.text)
        return

    except:
        print("提交视频完结异常!")


def getppt(cookies, courseOpenId, openClassId, cellId, moduleId):
    """
    获取ppt详细信息
    :param cookies:
    :param courseOpenId:
    :param openClassId:
    :param cellId:
    :param moduleId:
    :return:
    """
    url = "https://zjy2.icve.com.cn/api/common/Directory/viewDirectory"
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "cellId": cellId,
        "flag": "s",
        "moduleId": moduleId,
    }
    url1 = "https://zjy2.icve.com.cn/api/common/Directory/getCellCommentData"
    data1 = {
        "courseOpenId": courseOpenId,
        "cellId": cellId,
        "openClassId": openClassId,
        "type": 0
    }
    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        r1 = requests.post(url=url1, headers=headers, cookies=cookies, data=data1)
        return r.text
    except:
        return '获取ppt信息操作异常'


def pptdispose(cookies, courseOpenId, openClassId, cellId, token, pageCount):
    url = "https://zjy2.icve.com.cn/api/common/Directory/stuProcessCellLog"
    for i in range(20, int(pageCount), 20):
        data = {
            "courseOpenId": courseOpenId,
            "openClassId": openClassId,
            "cellId": cellId,
            "cellLogId": "",
            "picNum": i,
            "studyNewlyTime": 0,
            "studyNewlyPicNum": i,
            "token": token
        }
        try:
            r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
            print(r.text)
            time.sleep(3)
            print("正在处理中.....")
        except:
            print('ppt处理中途操作异常')

    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "cellId": cellId,
        "cellLogId": "",
        "picNum": pageCount,
        "studyNewlyTime": 0,
        "studyNewlyPicNum": pageCount,
        "token": token
    }
    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        print(r.text)
        return r.text
    except:
        return 'ppt处理结束操作异常'


def statement(cookies, courseOpenId, openClassId, moduleId, cellId, cellName):
    """
    声明现在观看的课程

    :param courseOpenId:
    :param openClassId:
    :param moduleId:
    :param cellId:
    :param cellName: 名称
    :return:
    """
    url = "https://zjy2.icve.com.cn/api/common/Directory/changeStuStudyProcessCellData"
    data = {
        "courseOpenId": courseOpenId,
        "openClassId": openClassId,
        "moduleId": moduleId,
        "cellId": cellId,
        "cellName": cellName,
    }
    try:
        r = requests.post(url=url, headers=headers, cookies=cookies, data=data)
        print(r.text)
        return r.text
    except:
        return '声明修改域异常'


def comment(cookies, courseOpenId, openClassId, cellId):
    url = "https://zjy2.icve.com.cn/api/common/Directory/addCellActivity"
    print("--++"*50)

    contentlist = [
        '此课程讲的非常好。
', '此课程采用多媒体教学设施使讲课效果良好。
', '老师讲的很好
', '课件不错,点赞
', '讲的不错,都明白了,点赞!
' ] data = { "courseOpenId": courseOpenId, "openClassId": openClassId, "content": random.choice(contentlist), "cellId": cellId, "star": 5, "activityType": 1 } try: r = requests.post(url=url, headers=headers, cookies=cookies, data=data) print(r.text) return r.text except: return '发布评论异常' if __name__ == '__main__': res = logo() cokie = res[1] # 用户信息 reslogininfo = res[0] logo_info = json.loads(reslogininfo) try: displayName = logo_info["displayName"] except: print("请检查账号信息") input("按任意键退出程序....") exit() userName = logo_info["userName"] userId = logo_info["userId"] print("你好! %s\n欢迎来到秋枫助手\n学号为:%s" % (displayName, userName)) infocourse = getcourse(cokie) infocourse = json.loads(infocourse) print(infocourse) ID = 1 # logostuSign(cokie) # exit() for i in infocourse["courseList"]: print("ID:%d 课程名称:%s" % (ID, i["courseName"])) ID += 1 # print(i) while (True): try: ocourseid = int(input("请输入课程ID:")) ocourseId = infocourse["courseList"][ocourseid - 1]["Id"] courseOpenId = infocourse["courseList"][ocourseid - 1]["courseOpenId"] openClassId = infocourse["courseList"][ocourseid - 1]["openClassId"] break except: print("请输入正确的课程ID") iscomment=0 while(True): try: iscommentif=input("是否开启随机评论:[1]【开启】[0]【不开启】,请输入1或者0:") if iscommentif=="0": iscomment=0 break elif iscommentif =="1": iscomment=1 break print("请输入1或者0") except: print("请输入1或者0") # 获取单元信息 infounit = getunit(cokie, courseOpenId, openClassId) infounit = json.loads(infounit) print(infounit) for i in infounit["progress"]["moduleList"]: print(i) print("单元名称:%s 进度:%s" % (i["name"], i["percent"])) if int(i["percent"]) == 100: print("本单元已完成,跳过!") continue moduleId = i["id"] infosection = getsection(cokie, courseOpenId, moduleId) infosection = json.loads(infosection) print(infosection) for i in infosection["topicList"]: print("小节名称:%s" % (i["name"])) topicId = i["id"] infoclassinfo = getclassinfo(cokie, courseOpenId, openClassId, topicId) infoclassinfo = json.loads(infoclassinfo) print(infoclassinfo) for i in infoclassinfo["cellList"]: print("每节课的详细信息开始", end="") print("*" * 160) print(i) time.sleep(5) cellId = i["Id"] if i["categoryName"] == "视频" or i["categoryName"] == "音频": print("开始处理视频.....") if iscomment==1: comment(cokie, courseOpenId, openClassId, cellId) if int(i["stuCellPercent"]) == 100: print("本节课已学完啦!跳过!") continue cellName = i["cellName"] statement(cokie, courseOpenId, openClassId, moduleId, cellId, cellName) infovideo = getvideo(cokie, courseOpenId, openClassId, cellId, moduleId) infovideo = json.loads(infovideo) print(infovideo) try: if infoppt["code"] == -33: continue except: pass token = infovideo["guIdToken"] videoTimeTotalLong = infovideo["audioVideoLong"] videodispose(cokie, courseOpenId, openClassId, cellId, token, videoTimeTotalLong) # exit() elif i["categoryName"] == "ppt" or i["categoryName"] == "文档" or i["categoryName"] == "链接" or i["categoryName"] == "图文" or i["categoryName"] == "图片"or i["categoryName"] == "压缩包" or i["categoryName"] == "swf": print("开始处理文档.....") if iscomment == 1: comment(cokie, courseOpenId, openClassId, cellId) if int(i["stuCellPercent"]) == 100: print("本节课已学完啦!跳过!") continue cellName = i["cellName"] statement(cokie, courseOpenId, openClassId, moduleId, cellId, cellName) infoppt = getppt(cokie, courseOpenId, openClassId, cellId, moduleId) infoppt = json.loads(infoppt) print(infoppt) try: if infoppt["code"] == -33: continue except: pass token = infoppt["guIdToken"] pageCount = infoppt["pageCount"] pptdispose(cokie, courseOpenId, openClassId, cellId, token, pageCount) elif i["categoryName"] == "子节点": for zz in i["childNodeList"]: print("=" * 100) print(zz) print("=" * 100) cellId = zz["Id"] cellName = zz["cellName"] if zz["categoryName"] == "视频" or zz["categoryName"] == "音频": print("开始处理视频.....") if iscomment == 1: comment(cokie, courseOpenId, openClassId, cellId) if int(zz["stuCellFourPercent"]) == 100: print("本节课已学完啦!跳过!") continue statement(cokie, courseOpenId, openClassId, moduleId, cellId, cellName) infovideo = getvideo(cokie, courseOpenId, openClassId, cellId, moduleId) infovideo = json.loads(infovideo) print(infovideo) try: if infoppt["code"] == -33: continue except: pass token = infovideo["guIdToken"] videoTimeTotalLong = infovideo["audioVideoLong"] videodispose(cokie, courseOpenId, openClassId, cellId, token, videoTimeTotalLong) # exit() elif zz["categoryName"] == "ppt" or zz["categoryName"] == "文档" or zz["categoryName"] == "链接" or zz["categoryName"] == "图文" or zz["categoryName"] == "图片" or zz["categoryName"] == "压缩包" or zz["categoryName"] == "swf": print("开始处理文档.....") if iscomment == 1: comment(cokie, courseOpenId, openClassId, cellId) if int(zz["stuCellFourPercent"]) == 100: print("本节课已学完啦!跳过!") continue statement(cokie, courseOpenId, openClassId, moduleId, cellId, cellName) infoppt = getppt(cokie, courseOpenId, openClassId, cellId, moduleId) infoppt = json.loads(infoppt) print(infoppt) try: if infoppt["code"] == -33: continue except: pass token = infoppt["guIdToken"] pageCount = infoppt["pageCount"] pptdispose(cokie, courseOpenId, openClassId, cellId, token, pageCount) print("-" * 100)

你可能感兴趣的:(python,java,php)