geektime

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// V1ColumnArticlesPath get all articles summary info in one column
	V1ColumnArticlesPath = "/serv/v1/column/articles"
	// V1ArticlePath used in normal column
	V1ArticlePath = "/serv/v1/article"

	// V3ColumnInfoPath used in get normal column/video info
	V3ColumnInfoPath = "/serv/v3/column/info"
	// V3ProductInfoPath used in get daily lesson, qconplus product info
	V3ProductInfoPath = "/serv/v3/product/info"
	// V3ArticleInfoPath used in normal video, daily lesson, qconplus
	V3ArticleInfoPath = "serv/v3/article/info"
	// V3VideoPlayAuthPath used in normal video, daily lesson, qconplus video play auth
	V3VideoPlayAuthPath = "serv/v3/source_auth/video_play_auth"

	// UniversityV1VideoPlayAuthPath used in university video play auth
	UniversityV1VideoPlayAuthPath = "/serv/v1/video/play-auth"
	// UniversityV1MyClassInfoPath get university class info and all articles info in it
	UniversityV1MyClassInfoPath = "/serv/v1/myclass/info"
)
View Source
const LoginPath = "/account/ticket/login"

LoginPath ...

Variables

View Source
var (
	// ErrWrongPassword ...
	ErrWrongPassword = errors.New("密码错误, 请尝试重新登录")
	// ErrTooManyLoginAttemptTimes ...
	ErrTooManyLoginAttemptTimes = errors.New("密码输入错误次数过多,已触发验证码校验,请稍后再试")
)
View Source
var (

	// SiteCookies ...
	SiteCookies []*http.Cookie
)

Functions

func Auth added in v0.2.1

func Auth() error

Auth check if current user login is expired or login in another device

func GetArticleInfo added in v0.5.1

func GetArticleInfo(articleID int) (response.V1ArticleResponse, error)

GetArticleInfo ...

func InitClient added in v0.4.1

func InitClient(cookies []*http.Cookie)

InitClient init golbal clients with cookies

func Login

func Login(phone, password string) ([]*http.Cookie, error)

Login call geektime login api and return auth cookies

func PostUniversityV1VideoPlayAuth added in v0.9.1

func PostUniversityV1VideoPlayAuth(articleID, classID int) (response.V1VideoPlayAuthResponse, error)

PostUniversityV1VideoPlayAuth ...

func PostV3ArticleInfo added in v0.9.1

func PostV3ArticleInfo(articleID int) (response.V3ArticleInfoResponse, error)

PostV3ArticleInfo used to get daily lesson or qconplus article info

func PostV3ProductInfo added in v0.9.1

func PostV3ProductInfo(productID int) (response.V3ProductInfoResponse, error)

PostV3ProductInfo used to get daily lesson or qconplus product info

func PostV3VideoPlayAuth added in v0.9.1

func PostV3VideoPlayAuth(articleID, sourceType int, videoID string) (string, error)

PostV3VideoPlayAuth get play auth string

Types

type Article added in v0.4.1

type Article struct {
	AID   int
	Title string
}

Article ...

func PostV1ColumnArticles added in v0.9.1

func PostV1ColumnArticles(cid string) ([]Article, error)

PostV1ColumnArticles call geektime api to get article list

type ErrGeekTimeAPIBadCode added in v0.3.2

type ErrGeekTimeAPIBadCode struct {
	Path           string
	ResponseString string
}

ErrGeekTimeAPIBadCode ...

func (ErrGeekTimeAPIBadCode) Error added in v0.3.2

func (e ErrGeekTimeAPIBadCode) Error() string

Error implements error interface

type Product added in v0.2.1

type Product struct {
	Access   bool
	ID       int
	Title    string
	Type     string
	Articles []Article
}

Product ...

func GetMyClassProduct added in v0.8.1

func GetMyClassProduct(classID int) (Product, error)

GetMyClassProduct ...

func PostV3ColumnInfo added in v0.9.1

func PostV3ColumnInfo(productID int) (Product, error)

PostV3ColumnInfo get normal column info, like v3 product info

type ProductType added in v0.9.1

type ProductType string

ProductType geektime product type

const (
	// ProductTypeColumn 专栏
	ProductTypeColumn ProductType = "c1"
	// ProductTypeNormalVideo 视频课
	ProductTypeNormalVideo ProductType = "c3"
	// ProductTypeDailyLesson 每日一课
	ProductTypeDailyLesson ProductType = "d"
	// ProductTypeQCONPlus 大厂案例
	ProductTypeQCONPlus ProductType = "q"
	// ProductTypeUniversityVideo 训练营视频,自定义类型
	ProductTypeUniversityVideo ProductType = "u"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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