service

package
v0.0.0-...-6879f62 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNotLogin not login
	ErrNotLogin = errors.New("当前未登录获取登录已失效,请先登录")
	//ErrLoginOffline not login
	ErrLoginOffline = errors.New("该账号已在其他同类设备登录,如非本人操作,则密码可能已经泄露,建议立即更换密码")
)

Functions

This section is empty.

Types

type Article

type Article struct {
	ID             int    `json:"id"`
	ArticleTitle   string `json:"article_title"`
	ArticleSummary string `json:"article_summary"`
	ArticleCover   string `json:"article_cover"`
	ArticleTime    int    `json:"article_ctime"`
	ChapterID      int    `json:"chapter_id string"`
	IncludeAudio   bool   `json:"include_audio"`
	//Is can preview
	ColumnHadSub        bool `json:"column_had_sub"`
	ArticleCouldPreview bool `json:"article_could_preview"`
	//Audio info
	AudioDownloadURL string `json:"audio_download_url"`
	AudioSize        int    `json:"audio_size"`
	//Viode info
	VideoMediaMap json.RawMessage `json:"video_media_map"`
	VideoID       string          `json:"video_id"`
	VideoCover    string          `json:"video_cover"`
}

Article 课程文章信息

func (*Article) IsCanPreview

func (article *Article) IsCanPreview() bool

IsCanPreview 是否能看

type Course

type Course struct {
	ID                int    `json:"id"`
	Authorintro       string `json:"author_intro"`
	AuthorName        string `json:"author_name"`
	ChannelBackAmount int    `json:"channel_back_amount"`
	ColumnBgcolor     string `json:"column_bgcolor"`
	ColumnCover       string `json:"column_cover"`
	ColumnCtime       int    `json:"column_ctime"`
	ColumnPrice       int    `json:"column_price"`
	ColumnPriceMarket int    `json:"column_price_market"`
	ColumnPriceSale   int    `json:"column_price_sale"`
	ColumnSku         int    `json:"column_sku"`
	ColumnSubtitle    string `json:"column_subtitle"`
	ColumnTitle       string `json:"column_title"`
	ColumnType        int    `json:"column_type"`
	ColumnTnit        string `json:"column_unit"`
	HadSub            bool   `json:"had_sub"`
	IsChannel         bool   `json:"is_channel"`
	IsExperience      bool   `json:"is_experience"`
	IsOnboard         bool   `json:"is_onboard"`
	PriceType         int    `json:"price_type"`
	SubCount          int    `json:"sub_count"`
	ShowChapter       bool   `json:"show_chapter"`
	UpdateFrequency   string `json:"update_frequency"`
}

Course 课程信息

func (*Course) IsColumn

func (course *Course) IsColumn() bool

IsColumn 是否专栏

func (*Course) IsVideo

func (course *Course) IsVideo() bool

IsVideo 是否视频

type CourseList

type CourseList struct {
	List []struct {
		ID                int  `json:"id"`
		ColumnCtime       int  `json:"column_ctime"`
		ColumnGroupbuy    int  `json:"column_groupbuy"`
		ColumnPrice       int  `json:"column_price"`
		ColumnPriceMarket int  `json:"column_price_market"`
		ColumnSku         int  `json:"column_sku"`
		ColumnType        int  `json:"column_type"`
		HadSub            bool `json:"had_sub"`
		IsChannel         int  `json:"is_channel"`
		IsExperience      bool `json:"is_experience"`
		LastAid           int  `json:"last_aid"`
		LastChapterID     int  `json:"last_chapter_id"`
		PriceType         int  `json:"price_type"`
		SubCount          int  `json:"sub_count"`
	} `json:"list"`
}

CourseList 课程列表基础信息

type Error

type Error interface {
	error
	IsUnlogin() bool
}

Error 错误信息接口

type ErrorInfo

type ErrorInfo struct {
	Err error
}

ErrorInfo error info

func (*ErrorInfo) Error

func (e *ErrorInfo) Error() string

func (*ErrorInfo) IsUnlogin

func (e *ErrorInfo) IsUnlogin() bool

IsUnlogin 是否未登录

func (*ErrorInfo) String

func (e *ErrorInfo) String() string

type Product

type Product struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
	Page  struct {
		More  bool `json:"more"`
		Count int  `json:"count"`
	} `json:"page"`
	List []struct {
		Title  string `json:"title"`
		Conver string `json:"cover"`
		Type   string `json:"type"`
		Extra  struct {
			LastAid        int    `json:"last_aid"`
			ColumnID       int    `json:"column_id"`
			ColumnTitle    string `json:"column_title"`
			ColumnSubtitle string `json:"column_subtitle"`
			AuthorName     string `json:"author_name"`
			AuthorIntro    string `json:"author_intro"`
			ColumnCover    string `json:"column_cover"`
			ColumnType     int    `json:"column_type"`
			ArticleCount   int    `json:"article_count"`
			IsIncludeAudio bool   `json:"is_include_audio"`
		} `json:"extra"`
	} `json:"list"`
}

Product all product

type ProductAll

type ProductAll struct {
	Columns *Product
	Videos  *Product
}

ProductAll all protuct

type Result

type Result struct {
	Code  int         `json:"code"`
	Data  resultData  `json:"data"`
	Error resultError `json:"error"`
}

Result 从百度服务器解析的数据结构

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service geek time service

func NewService

func NewService(gcid, gcess, serviceID string) *Service

NewService new service

func (*Service) Articles

func (s *Service) Articles(id int) ([]*Article, error)

Articles get course articles

func (*Service) BuyProductAll

func (s *Service) BuyProductAll() (*ProductAll, error)

BuyProductAll 获取所有购买的课程信息

func (*Service) Columns

func (s *Service) Columns() ([]*Course, error)

Columns 获取专栏

func (*Service) Cookies

func (s *Service) Cookies() map[string]string

Cookies get cookies string

func (*Service) ShowCourse

func (s *Service) ShowCourse(id int) (*Course, error)

ShowCourse 获取课程信息

func (*Service) User

func (s *Service) User() (*User, Error)

User user info

func (*Service) VideoPlayAuth

func (s *Service) VideoPlayAuth(aid int, videoID string) (*VideoPlayAuth, error)

VideoPlayAuth 获取视频的播放授权信息

func (*Service) VideoPlayInfo

func (s *Service) VideoPlayInfo(playAuth string) (*VideoPlayInfo, error)

VideoPlayInfo 获取视频播放信息

func (*Service) Videos

func (s *Service) Videos() ([]*Course, error)

Videos 获取专栏

type User

type User struct {
	UID       int    `json:"uid"`
	Nickname  string `json:"nickname"`
	Avatar    string `json:"avatar"`
	Cellphone string `json:"cellphone"`
}

User user info

type VideoPlayAuth

type VideoPlayAuth struct {
	PlayAuth string `json:"play_auth"`
}

VideoPlayAuth 视频的播放授权信息

type VideoPlayInfo

type VideoPlayInfo struct {
	VideoBase struct {
		VideoID  string `json:"VideoId"`
		Title    string `json:"Title"`
		CoverURL string `josn:"CoverURL"`
	} `json:"VideoBase"`
	PlayInfoList struct {
		PlayInfo []struct {
			URL        string `json:"PlayURL"`
			Size       int64  `json:"Size"`
			Definition string `json:"Definition"`
		} `json:"PlayInfo"`
	} `json:"PlayInfoList"`
}

VideoPlayInfo 视频播放信息

Jump to

Keyboard shortcuts

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