Last active
November 26, 2019 09:16
-
-
Save qnnnnez/ef02b3a6a282d0f7df13f72dcd6f09b8 to your computer and use it in GitHub Desktop.
cqooc.com Quick Learner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
learnlogs被拒绝访问了
可能是网站改版了,我这学期也不需要学这个了,我也不知道
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
返回Not authorised怎么办啊