日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

智慧职教mooc学院计算机文化基础答案,智慧职教MOOC学院-刷课分析

發布時間:2023/12/14 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 智慧职教mooc学院计算机文化基础答案,智慧职教MOOC学院-刷课分析 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

[Python] 純文本查看 復制代碼# -*- coding: utf-8 -*-

# [url=home.php?mod=space&uid=238618]@Time[/url] : 2020/12/26 15:17

# [url=home.php?mod=space&uid=686208]@AuThor[/url] : Melon

# [url=home.php?mod=space&uid=406162]@site[/url] :

# [url=home.php?mod=space&uid=267492]@file[/url] : mooc.py

# @Software: PyCharm

import time

import requests

import json

from PIL import Image

headers = {

'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',

}

# https://mooc.icve.com.cn/portal/LoginMooc/loginSystem?userName=LH17001&password=qwer%40123&verifycode=2405

# https://mooc.icve.com.cn/portal/course/getCourseOpenList

# https://mooc.icve.com.cn/study/learn/getProcessList?courseOpenId=wylwaxasdyjptaswj67x6g

# https://mooc.icve.com.cn/study/learn/getCellByTopicId

# https://mooc.icve.com.cn/study/learn/viewDirectory

# 0.登錄,拿到cookie------>https://mooc.icve.com.cn/portal/LoginMooc/loginSystem

def login(name, password):

'''

登錄

:param name: 用戶名

:param password: 密碼

:return: cookies

'''

# 驗證碼https://mooc.icve.com.cn/portal/LoginMooc/getVerifyCode?ts=1608968080542

codeUrl = "https://mooc.icve.com.cn/portal/LoginMooc/getVerifyCode?ts={}".format(int(round(time.time() * 1000)))

loginUrl = "https://mooc.icve.com.cn/portal/LoginMooc/loginSystem"

codeResult = requests.post(url=codeUrl, headers=headers)

with open("moocCode.jpg", "wb", ) as f:

f.write(codeResult.content)

# 驗證碼的cookies

code_cookies = codeResult.cookies

print("---------->驗證碼獲取完成,開始打開驗證碼")

img = Image.open("moocCode.jpg")

img.show()

print("---------->驗證碼打開完成,請輸入")

data = {

'userName': name,

'password': password,

'verifycode': input("輸入驗證碼:")

}

result = requests.post(url=loginUrl, data=data, headers=headers, cookies=code_cookies)

json_result = json.loads(result.text)

if json_result['code'] == 1 and json_result['msg'] == "登錄成功":

return result.cookies

else:

print(json_result['msg'])

return 0

# 1.獲取所有課程,拿到id-------->https://mooc.icve.com.cn/portal/course/getCourseOpenList

def getCourseOpenList(cookies):

'''

獲取所有課程

:param cookies: cookies

:return: [{"id":"wylwaxasdyjptaswj67x6g","text":"茶藝與茶文化_第四次開課"}]

'''

url = "https://mooc.icve.com.cn/portal/course/getCourseOpenList"

result = json.loads(requests.post(url=url, headers=headers, cookies=cookies).text)

return result['list']

# 2.得到一級目錄-------->https://mooc.icve.com.cn/study/learn/getProcessList?courseOpenId=wylwaxasdyjptaswj67x6g

def getProcessList(cookies, courseId):

'''

得到一級目錄

:param cookies: cookies

:param courseId: gtjkawksy5jf7raso8gdq

:return: [{'id': 'oitwaxas05rp25uktqp8a', 'name': '1.茶藝服務禮儀訓練', 'sortOrder': 1, 'percent': 40, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'qotwaxasf7tahcyr6kd8wa', 'name': '2.茶具的認識與使用', 'sortOrder': 2, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxasc7nbpxt8pmkjdw', 'name': '3.泡茶操作規范', 'sortOrder': 3, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxastoradnurwvdxq', 'name': '4.茶葉認識', 'sortOrder': 4, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxasv7zer5q5cks8gg', 'name': '5.泡茶規范與技術', 'sortOrder': 5, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'ritwaxashqlasilv5ziiew', 'name': '6.茶文化解讀', 'sortOrder': 6, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}]

'''

url = "https://mooc.icve.com.cn/study/learn/getProcessList"

result = json.loads(requests.post(url=url, data={'courseOpenId': courseId}, headers=headers, cookies=cookies).text)

return result['proces']['moduleList']

# 3.得到二級目錄-------->https://mooc.icve.com.cn/study/learn/getTopicByModuleId?courseOpenId=wylwaxasdyjptaswj67x6g&moduleId=q4twaxasc7nbpxt8pmkjdw

def getTopicByModuleId(cookies, courseId, moduleId):

'''

得到二級目錄

:param cookies: cookies

:param courseId: courseOpenId

:param moduleId: moduleId

:return: [{'id': 'pytwaxasupbiajdwbddwaw', 'name': '茶藝服務人員的儀容儀態', 'sortOrder': 0, 'upTopicId': '0', 'isLastStudy': False, 'studyStatus': 0}, {'id': 'qotwaxasyjbjd0mnjgxz1w', 'name': '各種行茶禮儀', 'sortOrder': 1, 'upTopicId': 'pytwaxasupbiajdwbddwaw', 'isLastStudy': False, 'studyStatus': 0}]

'''

url = "https://mooc.icve.com.cn/study/learn/getTopicByModuleId"

data = {

'courseOpenId': courseId,

'moduleId': moduleId

}

result = json.loads(requests.post(url=url, data=data, headers=headers, cookies=cookies).text)

return result['topicList']

# 4.獲得三級目錄(詳細信息)--------->https://mooc.icve.com.cn/study/learn/getCellByTopicId?courseOpenId=wylwaxasdyjptaswj67x6g&topicId=qotwaxasyjbjd0mnjgxz1w

def getCellByTopicId(cookies, courseId, topicId):

'''

獲得三級目錄(詳細信息)

:param cookies: cookies

:param courseId: courseOpenId

:param topicId: topicId

:return: [{'Id': 'qytwaxaso6hhfh3x0dnbw', 'resId': '', 'cellType': 4, 'isGJS': 1, 'parentId': 'pytwaxasupbiajdwbddwaw', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'topicId': 'pytwaxasupbiajdwbddwaw', 'categoryName': '子節點', 'cellName': '1.茶藝服務人員的妝容儀表要求', 'resourceUrl': '', 'externalLinkUrl': '', 'cellContent': '', 'sortOrder': 1, 'isAllowDownLoad': False, 'childNodeList': [{'Id': 'qotwaxasp4vae7z3zcwqua', 'resId': '', 'cellType': 1, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qytwaxaso6hhfh3x0dnbw', 'categoryName': '視頻', 'cellName': '茶藝師的儀容儀表要求', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': 'doc/g@F35D826F1BAAA3B655096B7E19435948.mp4', 'externalLinkUrl': '', 'cellContent': 'doc/g@F35D826F1BAAA3B655096B7E19435948.mp4', 'upCellId': '0', 'isStudyFinish': True, 'isUnlock': True}, {'Id': 'qotwaxasvrbgva1hlhnjuw', 'resId': '', 'cellType': 1, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qytwaxaso6hhfh3x0dnbw', 'categoryName': 'swf', 'cellName': '茶藝服務人員的儀容儀表要求', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': 'doc/g@55633CAC7D22C7247E99B7D650010E7D.swf', 'externalLinkUrl': '', 'cellContent': 'doc/g@55633CAC7D22C7247E99B7D650010E7D.swf', 'upCellId': 'qotwaxasp4vae7z3zcwqua', 'isStudyFinish': True, 'isUnlock': True}, {'Id': 'qotwaxasvrbejkntkxphtw', 'resId': '3ixwaxasg5ba3ri5avr79a', 'cellType': 6, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qytwaxaso6hhfh3x0dnbw', 'categoryName': '作業', 'cellName': '茶藝師的儀容儀表', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': '', 'externalLinkUrl': '', 'cellContent': '', 'upCellId': 'qotwaxasvrbgva1hlhnjuw', 'isStudyFinish': False, 'isUnlock': True}], 'upCellId': '-1', 'isStudyFinish': False, 'isUnlock': True}, {'Id': 'qotwaxasfj5jphzi8yiooq', 'resId': '', 'cellType': 4, 'isGJS': 1, 'parentId': 'pytwaxasupbiajdwbddwaw', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'topicId': 'pytwaxasupbiajdwbddwaw', 'categoryName': '子節點', 'cellName': '2.茶藝服務人員的儀態要求', 'resourceUrl': '', 'externalLinkUrl': '', 'cellContent': '', 'sortOrder': 2, 'isAllowDownLoad': False, 'childNodeList': [{'Id': 'qotwaxasf5fm1vtfllslya', 'resId': '', 'cellType': 1, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qotwaxasfj5jphzi8yiooq', 'categoryName': '視頻', 'cellName': '茶藝師的儀態', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': 'doc/g@AA759F5E1EE1978FD760C403B17EF08C.mp4', 'externalLinkUrl': '', 'cellContent': 'doc/g@AA759F5E1EE1978FD760C403B17EF08C.mp4', 'upCellId': 'qotwaxasvrbejkntkxphtw', 'isStudyFinish': True, 'isUnlock': True}, {'Id': 'qotwaxasy4hpjggnawg', 'resId': '', 'cellType': 1, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qotwaxasfj5jphzi8yiooq', 'categoryName': 'swf', 'cellName': '茶藝服務人員的儀態要求', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': 'doc/g@66FFBBA9CB37B03D4245418690E54815.swf', 'externalLinkUrl': '', 'cellContent': 'doc/g@66FFBBA9CB37B03D4245418690E54815.swf', 'upCellId': 'qotwaxasf5fm1vtfllslya', 'isStudyFinish': True, 'isUnlock': True}, {'Id': 'qotwaxasty1k8hfv4hrwmg', 'resId': '3ixwaxasu41ocvxkwprlxa', 'cellType': 6, 'isGJS': 1, 'isAllowDownLoad': False, 'parentId': 'qotwaxasfj5jphzi8yiooq', 'categoryName': '作業', 'cellName': '茶藝師的儀態要求', 'courseOpenId': 'wylwaxasdyjptaswj67x6g', 'resourceUrl': '', 'externalLinkUrl': '', 'cellContent': '', 'upCellId': 'qotwaxasy4hpjggnawg', 'isStudyFinish': False, 'isUnlock': True}], 'upCellId': '-1', 'isStudyFinish': False, 'isUnlock': True}]

'''

url = "https://mooc.icve.com.cn/study/learn/getCellByTopicId"

data = {

'courseOpenId': courseId,

'topicId': topicId

}

result = json.loads(requests.post(url=url, data=data, headers=headers, cookies=cookies).text)

return result['cellList']

# 5.拿到學習時長等信息---------->https://mooc.icve.com.cn/study/learn/viewDirectory?courseOpenId=wylwaxasdyjptaswj67x6g&cellId=qotwaxastizp0ktzqcnjg

def viewDirectory(cookies, courseOpenId, cellId):

'''

拿到學習時長等信息

:param cookies: cookies

:param courseOpenId: courseOpenId

:param cellId: cellId

:return: {'Id': 'cbwagosnyjooghaevg6fw', 'DateCreated': '/Date(1603976559000)/', 'CourseOpenId': 'gtjkawksy5jf7raso8gdq', 'TopicId': 'qc6vagosurpneukvl1nh1w', 'ParentId': 'qc6vagosly1owrpgpu6rg', 'CellName': '幼兒照護員的職業素養', 'CategoryName': 'ppt文檔', 'CellType': 1, 'ResourceUrl': 'doc/g@85031789B2B47C2167D68CA0418D9FD3.pptx', 'ExternalLinkUrl': None, 'CellContent': None, 'RarJsonData': None, 'ztWay': 0, 'SpaceCount': 0, 'IsAllowDownLoad': False, 'KnowledgeIds': '', 'KnowledgeTitle': '', 'SortOrder': 1, 'FromType': 2, 'ImpProjectId': '', 'ImpProjectName': '', 'ImpDocId': '', 'ImpDocTitle': '', 'ResId': '', 'NewSortOrder': 0, 'FromId': None, 'VideoTimeLong': 0, 'DocSize': 9023286, 'PageCount': 8, 'DateModified': '/Date(-62135596800000)/', 'VideoQuestionCount': 0, 'PlayType': 0, 'FromMOOCCellId': '', 'DocId': 'cbwagosz7nmuxz8cxclg', 'GreenScan': 'pass', 'GreenScanScene': '', 'TableName': 'MOOC_CourseProcessCell'}

'''

time.sleep(1)

url = "https://mooc.icve.com.cn/study/learn/viewDirectory"

data = {

'courseOpenId': courseOpenId,

'cellId': cellId

}

result = requests.post(url=url, data=data, headers=headers, cookies=cookies)

result = json.loads(result.text)

return result['courseCell']

# 6.開始刷課--------->https://mooc.icve.com.cn/study/learn/statStuProcessCellLogAndTimeLong?courseOpenId=wylwaxasdyjptaswj67x6g&cellId=qotwaxastizp0ktzqcnjg&auvideoLength=487&videoTimeTotalLong=487

def statStuProcessCellLogAndTimeLong(cookies, courseOpenId, cellId, videoTimeTotalLong):

'''

開始刷課

:param cookies: cookies

:param courseOpenId: courseOpenId

:param cellId: cellId

:param videoTimeTotalLong: videoTimeTotalLong

:return: {"code":1,"isStudy":true}

'''

time.sleep(1.5)

url = "https://mooc.icve.com.cn/study/learn/statStuProcessCellLogAndTimeLong"

data = {

'courseOpenId': courseOpenId,

'cellId': cellId,

'auvideoLength': videoTimeTotalLong,

'videoTimeTotalLong': videoTimeTotalLong

}

result = json.loads(requests.post(url=url, data=data, headers=headers, cookies=cookies).text)

return result

def start(name, password):

cookies = login(name=name, password=password) # 得到cookies用于后續登錄

course = getCourseOpenList(cookies) # 得到課程 [{'id': 'gtjkawksy5jf7raso8gdq', 'text': '幼兒照護(中級)_第一次開課'}]

for i in course:

print("進入課程:" + i['text'])

time.sleep(1)

# 一級目錄

moduleList1 = getProcessList(cookies=cookies, courseId=i[

'id']) # [{'id': 'oitwaxas05rp25uktqp8a', 'name': '1.茶藝服務禮儀訓練', 'sortOrder': 1, 'percent': 40, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'qotwaxasf7tahcyr6kd8wa', 'name': '2.茶具的認識與使用', 'sortOrder': 2, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxasc7nbpxt8pmkjdw', 'name': '3.泡茶操作規范', 'sortOrder': 3, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxastoradnurwvdxq', 'name': '4.茶葉認識', 'sortOrder': 4, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'q4twaxasv7zer5q5cks8gg', 'name': '5.泡茶規范與技術', 'sortOrder': 5, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}, {'id': 'ritwaxashqlasilv5ziiew', 'name': '6.茶文化解讀', 'sortOrder': 6, 'percent': 0, 'ModuleType': 1, 'ResId': '', 'isUnlock': True}]

for j in moduleList1:

time.sleep(0.25)

print("\t" + j['name'])

# 二級目錄

moduleList2 = getTopicByModuleId(cookies=cookies, courseId=i['id'], moduleId=j['id'])

for k in moduleList2:

time.sleep(0.25)

print("\t\t" + k['name'])

# 三級目錄

moduleList3 = getCellByTopicId(cookies=cookies, courseId=i['id'], topicId=k['id'])

for m in moduleList3:

time.sleep(0.25)

print("\t\t\t" + m['cellName'])

# 如果只有三級目錄

if not len(m['childNodeList']):

# =================================================================================================================================

# 如果課程完成-不刷課

if m['isStudyFinish'] is True:

print(

"\t\t\t\t" + m['cellName'] + "\t類型:" + m['categoryName'] + "\t\t------課程完成,不刷課-------")

continue

# 拿課程信息

info = viewDirectory(cookies=cookies, courseOpenId=m['courseOpenId'], cellId=m['Id'])

# 將信息拿去刷課

if not m['categoryName'] == "視頻" and not m['categoryName'] == "音頻":

# 如果不是視頻或者音頻

isOK = statStuProcessCellLogAndTimeLong(cookies=cookies, courseOpenId=info['CourseOpenId'],

cellId=info['Id'],

videoTimeTotalLong=0)

# 四級目錄(最終)

else:

# 是視頻或者音頻

isOK = statStuProcessCellLogAndTimeLong(cookies=cookies, courseOpenId=info['CourseOpenId'],

cellId=info['Id'],

videoTimeTotalLong=info['VideoTimeLong'])

if isOK['code'] == 1 and isOK['isStudy'] is True:

print("\t\t\t\t" + m['cellName'] + "\t類型:" + m['categoryName'] + "\t\t-----刷課OK----")

else:

print("\t\t\t\t" + m['cellName'] + "\t類型:" + m['categoryName'] + "\t\t-----ERROR----")

else:

# =================================================================================================================================

for n in m['childNodeList']:

time.sleep(0.5)

# 如果課程完成-不刷課

if n['isStudyFinish'] is True:

print("\t\t\t\t" + n['cellName'] + "\t類型:" + n[

'categoryName'] + "\t\t------課程完成,不刷課-------")

continue

# 拿課程信息

info = viewDirectory(cookies=cookies, courseOpenId=n['courseOpenId'], cellId=n['Id'])

# 將信息拿去刷課

if not n['categoryName'] == "視頻" and not n['categoryName'] == "音頻":

# 如果不是視頻或者音頻

isOK = statStuProcessCellLogAndTimeLong(cookies=cookies,

courseOpenId=info['CourseOpenId'],

cellId=info['Id'],

videoTimeTotalLong=0)

else:

# 是視頻或者音頻

isOK = statStuProcessCellLogAndTimeLong(cookies=cookies,

courseOpenId=info['CourseOpenId'],

cellId=info['Id'],

videoTimeTotalLong=info['VideoTimeLong'])

if isOK['code'] == 1 and isOK['isStudy'] is True:

print("\t\t\t\t" + n['cellName'] + "\t類型:" + n['categoryName'] + "\t\t-----刷課OK----")

else:

print("\t\t\t\t" + n['cellName'] + "\t類型:" + n['categoryName'] + "\t\t-----ERROR----")

if __name__ == '__main__':

# ====================== # 只需要填寫

name = "賬號" # 賬號

password = "密碼" # 密碼

# ====================== # 然后運行,然后輸入驗證碼

start(name=name, password=password)

總結

以上是生活随笔為你收集整理的智慧职教mooc学院计算机文化基础答案,智慧职教MOOC学院-刷课分析的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。