Documentation
¶
Index ¶
- Constants
- Variables
- func Auth(cs []*http.Cookie) error
- func Login(phone, password string) ([]*http.Cookie, error)
- type Article
- type Client
- func (c *Client) CourseInfo(productID int) (Course, error)
- func (c *Client) EnterpriseCourseInfo(id int) (Course, error)
- func (c *Client) EnterpriseVideoPlayAuth(articleID, videoID string) (string, error)
- func (c *Client) ProductInfo(productID int) (response.V3ProductInfoResponse, error)
- func (c *Client) UniversityCourseInfo(classID int) (Course, error)
- func (c *Client) UniversityVideoPlayAuth(articleID, classID int) (response.V1VideoPlayAuthResponse, error)
- func (c *Client) V1ArticleInfo(articleID int) (response.V1ArticleResponse, error)
- func (c *Client) V1EnterpriseArticleDetail(articleID string) (response.V1EnterpriseArticlesDetailResponse, error)
- func (c *Client) V3ArticleInfo(articleID int) (response.V3ArticleInfoResponse, error)
- func (c *Client) VideoPlayAuth(articleID, sourceType int, videoID string) (string, error)
- type Course
- type ErrGeekTimeAPIBadCode
Constants ¶
View Source
const ( // GeekBangAccountBaseURL ... GeekBangAccountBaseURL = "https://account.geekbang.org" // LoginPath ... LoginPath = "/account/ticket/login" // V1AuthPath ... V1AuthPath = "/serv/v1/user/auth" )
View Source
const ( DefaultTimeout = 10 * time.Second // Origin ... Origin = "Origin" // UserAgent ... UserAgent = "User-Agent" // DefaultUserAgent ... DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36" )
View Source
const ( // GeekBangEnterpriseBaseURL is geekbang enterprise base URL GeekBangEnterpriseBaseURL = "https://b.geekbang.org" // V1EnterpriseCourseInfoPath used in enterprise course product info V1EnterpriseCourseInfoPath = "/app/v1/course/info" // V1EnterpriseArticlesInfoPath used in enterprise course articles info V1EnterpriseArticlesInfoPath = "/app/v1/course/articles" // V1EnterpriseArticleDetailPath used in enterprise course article detail info V1EnterpriseArticleDetailPath = "/app/v1/article/detail" // V1EnterpriseVideoPlayAuthPath used in enterprise course video play auth V1EnterpriseVideoPlayAuthPath = "/app/v1/source_auth/video_play_auth" )
View Source
const ( // DefaultBaseURL ... DefaultBaseURL = "https://time.geekbang.org" // 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" // GeekBangCookieDomain ... GeekBangCookieDomain = ".geekbang.org" // GCID ... GCID = "GCID" // GCESS ... GCESS = "GCESS" )
View Source
const ( // GeekBangUniversityBaseURL ... GeekBangUniversityBaseURL = "https://u.geekbang.org" // 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" )
Variables ¶
View Source
var ( // ErrWrongPassword ... ErrWrongPassword = errors.New("密码错误, 请尝试重新登录") // ErrTooManyLoginAttemptTimes ... ErrTooManyLoginAttemptTimes = errors.New("密码输入错误次数过多,已触发验证码校验,请稍后再试") // ErrGeekTimeRateLimit ... ErrGeekTimeRateLimit = errors.New("已触发限流, 你可以选择重新登录/重新获取 cookie, 或者稍后再试, 然后生成剩余的文章") // ErrAuthFailed ... ErrAuthFailed = errors.New("当前账户在其他设备登录或者登录已经过期, 请尝试重新登录") )
Functions ¶
Types ¶
type Client ¶ added in v0.10.1
A Client manages communication with the Geektime API.
func (*Client) CourseInfo ¶ added in v0.11.1
CourseInfo get narmal geektime course info
func (*Client) EnterpriseCourseInfo ¶ added in v0.11.1
EnterpriseCourseInfo get enterprise course info
func (*Client) EnterpriseVideoPlayAuth ¶ added in v0.11.1
EnterpriseVideoPlayAuth get enterprise play auth string
func (*Client) ProductInfo ¶ added in v0.10.1
func (c *Client) ProductInfo(productID int) (response.V3ProductInfoResponse, error)
ProductInfo used to get daily lesson or qconplus product info
func (*Client) UniversityCourseInfo ¶ added in v0.11.1
UniversityCourseInfo get university class info
func (*Client) UniversityVideoPlayAuth ¶ added in v0.10.1
func (c *Client) UniversityVideoPlayAuth(articleID, classID int) (response.V1VideoPlayAuthResponse, error)
UniversityVideoPlayAuth get university play auth string
func (*Client) V1ArticleInfo ¶ added in v0.10.1
func (c *Client) V1ArticleInfo(articleID int) (response.V1ArticleResponse, error)
V1ArticleInfo ...
func (*Client) V1EnterpriseArticleDetail ¶ added in v0.11.1
func (c *Client) V1EnterpriseArticleDetail(articleID string) (response.V1EnterpriseArticlesDetailResponse, error)
V1EnterpriseArticleDetail get enterprise article detail
func (*Client) V3ArticleInfo ¶ added in v0.10.1
func (c *Client) V3ArticleInfo(articleID int) (response.V3ArticleInfoResponse, error)
V3ArticleInfo used to get daily lesson or qconplus article info
type ErrGeekTimeAPIBadCode ¶ added in v0.3.2
ErrGeekTimeAPIBadCode ...
func (ErrGeekTimeAPIBadCode) Error ¶ added in v0.3.2
func (e ErrGeekTimeAPIBadCode) Error() string
Error implements error interface
Click to show internal directories.
Click to hide internal directories.