xuexitong

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiLoginWeb = "https://passport2.chaoxing.com/fanyalogin"

	ApiPullCourses = "https://mooc1-api.chaoxing.com/mycourse/backclazzdata"

	// ApiChapterPoint 接口-课程章节任务点状态
	ApiChapterPoint = "https://mooc1-api.chaoxing.com/job/myjobsnodesmap"
	ApiChapterCards = "https://mooc1-api.chaoxing.com/gas/knowledge"
	ApiPullChapter  = "https://mooc1-api.chaoxing.com/gas/clazz"

	// PageMobileChapterCard SSR页面-客户端章节任务卡片
	PageMobileChapterCard = "https://mooc1-api.chaoxing.com/knowledge/cards"

	// APIChapterCardResource 接口-课程章节卡片资源
	APIChapterCardResource = "https://mooc1-api.chaoxing.com/ananas/status"
	// APIVideoPlayReport 接口-视频播放上报
	APIVideoPlayReport  = "https://mooc1.chaoxing.com/mooc-ans/multimedia/log/a"
	APIVideoPlayReport2 = "https://mooc1-api.chaoxing.com/multimedia/log/a" // cxkitty的

	// ApiWorkCommit 接口-单元作业答题提交
	ApiWorkCommit = "https://mooc1-api.chaoxing.com/work/addStudentWorkNew"
	// ApiWorkCommitNew 接口-新的作业提交答案接口
	ApiWorkCommitNew = "https://mooc1.chaoxing.com/mooc-ans/work/addStudentWorkNew"

	// 接口-课程文档阅读上报
	ApiDocumentReadingReport = "https://mooc1.chaoxing.com/ananas/job/document"

	// PageMobileWork SSR页面-客户端单元测验答题页
	PageMobileWork  = "https://mooc1-api.chaoxing.com/android/mworkspecial"           // 这是个cxkitty中的
	PageMobileWorkY = "https://mooc1-api.chaoxing.com/mooc-ans/work/phone/doHomeWork" // 这个是自己爬的

	KEY             = "u2oh6Vu^HWe4_AES" // 注意 Go 语言中字符串默认就是 UTF-8 编码
	APP_VERSION     = "6.4.5"
	DEVICE_VENDOR   = "MI10"
	BUILD           = "10831_263"
	ANDROID_VERSION = "Android 9"
)

注意Api类文件主需要写最原始的接口请求和最后的json的string形式返回,不需要用结构体序列化。 序列化和具体的功能实现请移步到Action代码文件中

Variables

View Source
var IMEI = utils.TokenHex(16)

Functions

func GetUA added in v1.8.1

func GetUA(uaType string) string

GetUA 构建并获取 UA

func MobileUASign added in v1.8.1

func MobileUASign(model, locale, version, build, imei string) string

Types

type APIError

type APIError struct {
	Message string
}

func (*APIError) Error

func (e *APIError) Error() string

type XueXiTUserCache

type XueXiTUserCache struct {
	Name     string //用户使用Phone
	Password string //用户密码

	UserID      string // 用户ID
	JsonContent map[string]interface{}

	IpProxySW bool   // 是否开启代理
	ProxyIP   string //代理IP
	// contains filtered or unexported fields
}

func (*XueXiTUserCache) CourseListApi

func (cache *XueXiTUserCache) CourseListApi(retry int, lastErr error) (string, error)

CourseListApi 拉取对应账号的课程数据

func (*XueXiTUserCache) DocumentDtoReadingReport added in v1.2.0

func (cache *XueXiTUserCache) DocumentDtoReadingReport(p *entity.PointDocumentDto) (string, error)

func (*XueXiTUserCache) DocumentDtoReadingReportWeb added in v1.8.6

func (cache *XueXiTUserCache) DocumentDtoReadingReportWeb(p *entity.PointDocumentDto) (string, error)

另一个文档完成接口

func (*XueXiTUserCache) EnterChapterForwardCall added in v1.8.6

func (cache *XueXiTUserCache) EnterChapterForwardCall(courseId, clazzid, chapterId, cpi string)

每次进入章节前进行一次调用,防止0任务点无法学习的情况

func (*XueXiTUserCache) FetchChapterCords

func (cache *XueXiTUserCache) FetchChapterCords(nodes []int, index, courseId int, retry int, lastErr error) (string, error)

FetchChapterCords 拉取对应“章节”的任务节点卡片资源 Args:

nodes: 任务点集合 , index: 任务点索引

func (*XueXiTUserCache) FetchChapterCords2 added in v1.2.8

func (cache *XueXiTUserCache) FetchChapterCords2(clazzid, courseid, knowledgeid, cpi string) (string, error)

FetchChapterCords2 以课程序号拉取对应“章节”的任务节点卡片资源接口2 Args:

nodes: 任务点集合 , index: 任务点索引

func (*XueXiTUserCache) FetchChapterPointStatus

func (cache *XueXiTUserCache) FetchChapterPointStatus(nodes []int, clazzID, userID, cpi, courseID int) (string, error)

FetchChapterPointStatus 章节状态 nodes 各章节对应ID

func (*XueXiTUserCache) GetCookie

func (cache *XueXiTUserCache) GetCookie() string

func (*XueXiTUserCache) GetCookies added in v1.6.8

func (cache *XueXiTUserCache) GetCookies() []*http.Cookie

func (*XueXiTUserCache) GetCourseFaceQrPlan1Api added in v1.2.0

func (cache *XueXiTUserCache) GetCourseFaceQrPlan1Api(courseId, classId, uuid, objectId, qrcEnc, failCount string) (string, error)

过人脸(第一版)

func (*XueXiTUserCache) GetCourseFaceQrPlan2Api added in v1.2.0

func (cache *XueXiTUserCache) GetCourseFaceQrPlan2Api(classId, courseId, knowledgeId, cpi, objectId string) (string, error)

过人脸(第二版)

func (*XueXiTUserCache) GetCourseFaceQrPlan3Api added in v1.4.7

func (cache *XueXiTUserCache) GetCourseFaceQrPlan3Api(uuid, clazzId, courseId, qrcEnc, objectId string) (string, error)

过人脸(第三版)

func (*XueXiTUserCache) GetCourseFaceQrStateApi added in v1.2.0

func (cache *XueXiTUserCache) GetCourseFaceQrStateApi(uuid, enc, clazzid, courseid, cpi, mid, videoObjectId, videoRandomCollectTime, chapterId string) (string, error)

获取人脸状态(二维码状态)

func (cache *XueXiTUserCache) GetCourseFaceQrStateApi() (string, error) {
	method := "GET"

	client := &http.Client{}
	req, err := http.NewRequest(method, "https://mooc1-api.chaoxing.com/knowledge/uploadInfo", nil)

	if err != nil {
		return "", err
	}
	req.Header.Add("Cookie", cache.cookie)
	req.Header.Add("User-Agent", "Apifox/1.0.0 (https://apifox.com)")

	res, err := client.Do(req)
	if err != nil {
		return "", err
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return "", err
	}
	return string(body), nil
}

获取人脸状态{"code":"0","failCount":"90","videoFaceCaptureSuccessEnc":"2416cd8e0f5949d4b4d66da05aafb15a","compareResult":"0","status":2}

func (*XueXiTUserCache) GetFaceQrCodeApi1 added in v1.4.7

func (cache *XueXiTUserCache) GetFaceQrCodeApi1(courseId, clazzid, chapterId, cpi string) (string, string, error)

获取人脸的必要数据(老的)

func (*XueXiTUserCache) GetFaceQrCodeApi2 added in v1.4.7

func (cache *XueXiTUserCache) GetFaceQrCodeApi2(courseId, clazzId, cpi string) (string, string, error)

获取人脸的必要数据(这个一般是在主页打开课程时触发)

func (*XueXiTUserCache) GetFaceQrCodeApi3 added in v1.5.5

func (cache *XueXiTUserCache) GetFaceQrCodeApi3(courseId, clazzid, chapterId, cpi, enc, videojobid, chaptervideoobjectid string) (string, string, error)

拉人脸数据3(课程中)

func (*XueXiTUserCache) GetFaceUpLoadToken added in v1.4.7

func (cache *XueXiTUserCache) GetFaceUpLoadToken() (string, error)

用于获取云盘token(用于人脸)

func (*XueXiTUserCache) GetHistoryFaceImg added in v1.5.6

func (cache *XueXiTUserCache) GetHistoryFaceImg(puid string) (string, image.Image, error)

获取历史人脸图片

func (*XueXiTUserCache) LoginApi

func (cache *XueXiTUserCache) LoginApi() (string, error)

LoginApi 登录Api

func (*XueXiTUserCache) MonitorApi added in v1.5.6

func (cache *XueXiTUserCache) MonitorApi() (string, error)

学习通不知道用来干嘛的接口,但是每隔一段时间都会发送一次

func (*XueXiTUserCache) PageMobileChapterCard added in v1.0.6

func (cache *XueXiTUserCache) PageMobileChapterCard(
	classId, courseId, knowledgeId, cardIndex, cpi int) (string, error)

PageMobileChapterCard 客户端章节任务卡片 原始html数据返回

func (*XueXiTUserCache) PullChapter

func (cache *XueXiTUserCache) PullChapter(cpi int, key int) (string, error)

PullChapter ??????????cpi ?key ?? ???? cpi ? key ?? ????json?????? int TODO???? int ???????? ?Course???????? ? ?action?????XueXiTCourseDetailForCourseIdAction???? ???

func (*XueXiTUserCache) SetCookies added in v1.6.8

func (cache *XueXiTUserCache) SetCookies(cookies []*http.Cookie)

func (*XueXiTUserCache) UploadFaceImageApi added in v1.5.0

func (cache *XueXiTUserCache) UploadFaceImageApi(token string, image image.Image) (string, error)

上传人脸图片

func (*XueXiTUserCache) UploadFaceImageForPUIDApi added in v1.5.0

func (cache *XueXiTUserCache) UploadFaceImageForPUIDApi(puid string) (string, error)

根据PUID查找人脸图片上传

func (*XueXiTUserCache) VerificationCodeApi

func (cache *XueXiTUserCache) VerificationCodeApi() (string, string)

VerificationCodeApi 获取验证码和SESSION验证码,并返回文件路径和SESSION字符串

func (*XueXiTUserCache) VideoDtoFetch added in v1.0.6

func (cache *XueXiTUserCache) VideoDtoFetch(p *entity.PointVideoDto) (string, error)

VideoDtoFetch 视频数据

func (*XueXiTUserCache) VideoDtoPlayReport deprecated added in v1.0.7

func (cache *XueXiTUserCache) VideoDtoPlayReport(p *entity.PointVideoDto, playingTime int, isdrag int, retry int, lastErr error) (string, error)

Deprecated: 此方法有BUG不推荐使用,将会在未来版本删除

func (*XueXiTUserCache) VideoSubmitStudyTime added in v1.2.8

func (cache *XueXiTUserCache) VideoSubmitStudyTime(p *entity.PointVideoDto, playingTime int, isdrag int, retry int, lastErr error) (string, error)

func (*XueXiTUserCache) VideoSubmitStudyTimePE added in v1.8.1

func (cache *XueXiTUserCache) VideoSubmitStudyTimePE(p *entity.PointVideoDto, playingTime int, isdrag int, retry int, lastErr error) (string, error)

VideoSubmitStudyTimePE 手机端学时提交

func (*XueXiTUserCache) WorkCommit added in v1.1.2

func (cache *XueXiTUserCache) WorkCommit(p *entity.PointWorkDto, fields []entity.WorkInputField) (string, error)

func (*XueXiTUserCache) WorkFetchQuestion added in v1.0.9

func (cache *XueXiTUserCache) WorkFetchQuestion(p *entity.PointWorkDto) (string, error)

WorkFetchQuestion 获取作业题目

func (*XueXiTUserCache) WorkNewSubmitAnswer added in v1.4.2

func (cache *XueXiTUserCache) WorkNewSubmitAnswer(courseId string, classId string, knowledgeid string,
	cpi string, jobid string, totalQuestionNum string, answerId string,
	workAnswerId string, api string, fullScore string, oldSchoolId string,
	oldWorkId string, workRelationId string, enc_work string, question entity.Question, isSubmit string) (string, error)

WorkNewSubmitAnswer 新的提交作业答案的接口

func (*XueXiTUserCache) XueXiTPassVerificationCode added in v1.8.3

func (cache *XueXiTUserCache) XueXiTPassVerificationCode(code string, retry int, lastErr error) (bool, error)

提交学习通验证码

func (*XueXiTUserCache) XueXiTVerificationCodeApi added in v1.8.3

func (cache *XueXiTUserCache) XueXiTVerificationCodeApi(retry int, lastErr error) (string, error)

获取学习通验证码

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL