lib

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MyPointsUri = "https://pc.xuexi.cn/points/my-points.html"

	DailyBUTTON   = `` /* 151-byte string literal not displayed */
	WEEKEND       = `` /* 151-byte string literal not displayed */
	SPECIALBUTTON = `` /* 151-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func CheckUserCookie

func CheckUserCookie(user *model.User) bool

获取用户成绩

func CookieToJar added in v1.0.46

func CookieToJar(cookies []Cookie) []*http.Cookie

func CookieToParam added in v1.0.46

func CookieToParam(cookies []Cookie) []playwright.BrowserContextAddCookiesOptionsCookies

func FillBlank

func FillBlank(page playwright.Page, tips []string) error

填空题

func FormatScore

func FormatScore(score Score) string

格式化总分

func FormatScoreShort added in v1.0.31

func FormatScoreShort(score Score) string

格式化短格式总分

func GetAnswerPage added in v1.0.46

func GetAnswerPage(page playwright.Page, model string) bool

func GetSpecialIDs added in v1.0.46

func GetSpecialIDs(cookies []*http.Cookie) []int

获取专项答题ID列表

func GetToken

func GetToken(code, sign, pushId string) (bool, error)

获取Token

func GetUserInfo

func GetUserInfo(cookies []*http.Cookie) (string, string, error)

获取用户信息

func GetweekIDs added in v1.0.46

func GetweekIDs(cookies []*http.Cookie) []int

获取每周答题ID列表

func PrintScore

func PrintScore(score Score) string

输出总分

func RemoveRepByLoop

func RemoveRepByLoop(slc []string) []string

RemoveRepByLoop 通过两重循环过滤重复元素

func Study added in v1.0.39

func Study(core2 *Core, u *model.User)

Types

type Cookie struct {
	Name     string `json:"name" yaml:"name"`
	Value    string `json:"value" yaml:"value"`
	Domain   string `json:"domain" yaml:"domain"`
	Path     string `json:"path" yaml:"path"`
	Expires  int    `json:"expires" yaml:"expires"`
	HTTPOnly bool   `json:"httpOnly" yaml:"http_only"`
	Secure   bool   `json:"secure" yaml:"secure"`
	SameSite string `json:"same_site" yaml:"same_site"`
}

Cookie @Description:

type Core

type Core struct {
	ShowBrowser bool
	Push        func(id string, kind string, message string)
	// contains filtered or unexported fields
}

Core @Description:

func (*Core) CheckQrCode

func (c *Core) CheckQrCode(code, pushID string) (*model.User, bool, error)

检查二维码状态

func (*Core) GenerateCode

func (c *Core) GenerateCode(pushID string) (string, string, error)

生成二维码

func (*Core) Init

func (c *Core) Init()

初始化

func (*Core) IsQuit

func (c *Core) IsQuit() bool

检查浏览器是否关闭

func (*Core) L

func (c *Core) L(retryTimes int, pushID string) (*model.User, error)

轮询

func (*Core) LearnArticle

func (c *Core) LearnArticle(user *model.User)

文章学习

func (*Core) LearnVideo

func (c *Core) LearnVideo(user *model.User)

视频学习

func (*Core) Quit

func (c *Core) Quit()

关闭浏览器

func (*Core) RadioStation added in v1.0.44

func (c *Core) RadioStation(user *model.User)

音频学习

func (*Core) RespondDaily

func (c *Core) RespondDaily(user *model.User, model string)

每日答题

type Data

type Data struct {
	CurrentScore int `json:"current_score"`
	MaxScore     int `json:"max_score"`
}
type Link struct {
	Editor       string   `json:"editor"`
	PublishTime  string   `json:"publishTime"`
	ItemType     string   `json:"itemType"`
	Author       string   `json:"author"`
	CrossTime    int      `json:"crossTime"`
	Source       string   `json:"source"`
	NameB        string   `json:"nameB"`
	Title        string   `json:"title"`
	Type         string   `json:"type"`
	Url          string   `json:"url"`
	ShowSource   string   `json:"showSource"`
	ItemId       string   `json:"itemId"`
	ThumbImage   string   `json:"thumbImage"`
	AuditTime    string   `json:"auditTime"`
	ChannelNames []string `json:"channelNames"`
	Producer     string   `json:"producer"`
	ChannelIds   []string `json:"channelIds"`
	DataValid    bool     `json:"dataValid"`
}

type Score

type Score struct {
	TotalScore int             `json:"total_score"`
	TodayScore int             `json:"today_score"`
	Content    map[string]Data `json:"content"`
}

func GetUserScore

func GetUserScore(cookies []*http.Cookie) (Score, error)

获取用户总分

type SpecialContent added in v1.0.38

type SpecialContent struct {
	Perfect   bool `json:"perfect"`
	TotalTime int  `json:"totalTime"`
	Questions []struct {
		HasDescribe bool `json:"hasDescribe"`
		// 提示信息
		QuestionDesc string `json:"questionDesc"`
		QuestionId   int    `json:"questionId"`
		Origin       string `json:"origin"`
		// 答案
		Answers []struct {
			AnswerId int    `json:"answerId"`
			Label    string `json:"label"`
			Content  string `json:"content"`
		} `json:"answers"`
		QuestionScore int `json:"questionScore"`
		// 题目呢偶然
		Body               string `json:"body"`
		OriginTitle        string `json:"originTitle"`
		AllCorrect         bool   `json:"allCorrect"`
		Supplier           string `json:"supplier"`
		QuestionDescOrigin string `json:"questionDescOrigin"`
		QuestionDisplay    int    `json:"questionDisplay"`
		Recommender        string `json:"recommender"`
	} `json:"questions"`
	Type               int    `json:"type"`
	TotalScore         int    `json:"totalScore"`
	PassScore          int    `json:"passScore"`
	FinishedNum        int    `json:"finishedNum"`
	UsedTime           int    `json:"usedTime"`
	Name               string `json:"name"`
	QuestionNum        int    `json:"questionNum"`
	Id                 int    `json:"id"`
	UniqueId           string `json:"uniqueId"`
	TipScoreReasonType int    `json:"tipScoreReasonType"`
}

func GetSpecialContent added in v1.0.38

func GetSpecialContent(cookies []*http.Cookie, id int) *SpecialContent

type SpecialList

type SpecialList struct {
	PageNo         int `json:"pageNo"`
	PageSize       int `json:"pageSize"`
	TotalPageCount int `json:"totalPageCount"`
	TotalCount     int `json:"totalCount"`
	List           []struct {
		TipScore    float64 `json:"tipScore"`
		EndDate     string  `json:"endDate"`
		Achievement struct {
			Score   int `json:"score"`
			Total   int `json:"total"`
			Correct int `json:"correct"`
		} `json:"achievement"`
		Year             int    `json:"year"`
		SeeSolution      bool   `json:"seeSolution"`
		Score            int    `json:"score"`
		ExamScoreId      int    `json:"examScoreId"`
		UsedTime         int    `json:"usedTime"`
		Overdue          bool   `json:"overdue"`
		Month            int    `json:"month"`
		Name             string `json:"name"`
		QuestionNum      int    `json:"questionNum"`
		AlreadyAnswerNum int    `json:"alreadyAnswerNum"`
		StartTime        string `json:"startTime"`
		Id               int    `json:"id"`
		ExamTime         int    `json:"examTime"`
		Forever          int    `json:"forever"`
		StartDate        string `json:"startDate"`
		Status           int    `json:"status"`
	} `json:"list"`
	PageNum int `json:"pageNum"`
}

专项答题JSON结构

type T

type T struct {
	Question    string      `json:"question"`
	Answer      string      `json:"answer"`
	WrongAnswer string      `json:"wrongAnswer"`
	Option      string      `json:"option"`
	Datetime    interface{} `json:"datetime"`
}

type WeekList

type WeekList struct {
	PageNo         int `json:"pageNo"`
	PageSize       int `json:"pageSize"`
	TotalPageCount int `json:"totalPageCount"`
	TotalCount     int `json:"totalCount"`
	List           []struct {
		Month     string `json:"month"`
		Practices []struct {
			SeeSolution bool    `json:"seeSolution"`
			TipScore    float64 `json:"tipScore"`
			ExamScoreId int     `json:"examScoreId"`
			Overdue     bool    `json:"overdue"`
			Achievement struct {
				Total   int `json:"total"`
				Correct int `json:"correct"`
			} `json:"achievement"`
			Name               string `json:"name"`
			BeginYear          int    `json:"beginYear"`
			StartTime          string `json:"startTime"`
			Id                 int    `json:"id"`
			BeginMonth         int    `json:"beginMonth"`
			Status             int    `json:"status"`
			TipScoreReasonType int    `json:"tipScoreReasonType"`
		} `json:"practices"`
	} `json:"list"`
	PageNum int `json:"pageNum"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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