Skip to content

Instantly share code, notes, and snippets.

@qnnnnez
Last active November 26, 2019 09:16
Show Gist options
  • Save qnnnnez/ef02b3a6a282d0f7df13f72dcd6f09b8 to your computer and use it in GitHub Desktop.
Save qnnnnez/ef02b3a6a282d0f7df13f72dcd6f09b8 to your computer and use it in GitHub Desktop.
cqooc.com Quick Learner
# config
username = '' # your username used to login
user_id = int() # should be a integer
courseId = ''
cookie_xsid = '' # find it in your browser after logging in
finish_time = '' # e.g. 20181222
parentId = ''
from requests import Session
session = Session()
session.cookies['xsid'] = cookie_xsid
def fuck(courseId, sectionId, chapterId):
endpoint = 'http://www.cqooc.com/json/learnLogs'
payload = {
'username': username,
'ownerId': user_id,
'parentId': parentId,
'action': 0,
'courseId': str(courseId),
'sectionId': str(sectionId),
'chapterId': str(chapterId),
'category': 2,
'time': finish_time,
}
#print(payload)
return session.post(endpoint, json=payload)
def learn_course(courseId):
endpoint = 'http://www.cqooc.com/json/chapter/lessons?courseId='+courseId
j = session.get(endpoint).json()['data'][0]['body']
for chapterId, sectionIds in j.items():
for sectionId in sectionIds:
print('learning', chapterId, sectionId)
print(fuck(courseId, sectionId, chapterId).text)
learn_course(courseId)
@xkl150
Copy link

xkl150 commented Nov 23, 2019

返回Not authorised怎么办啊

@zilei91186
Copy link

learnlogs被拒绝访问了

@qnnnnez
Copy link
Author

qnnnnez commented Nov 26, 2019

可能是网站改版了,我这学期也不需要学这个了,我也不知道

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment