Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) BuildURL(path string) string
- func (c *Client) Get(path string) (*goquery.Document, error)
- func (c *Client) GetCurrentUser() (*model.User, error)
- func (c *Client) GetRaw(path string) (*resty.Response, error)
- func (c *Client) GetTopicDetail(topicURL string) (*model.Topic, []model.Reply, error)
- func (c *Client) GetTopicDetailPage(topicURL string, page int) (*model.Topic, []model.Reply, error)
- func (c *Client) GetTopicsByNode(nodeCode string, page int) (*NodeTopicsResult, error)
- func (c *Client) GetTopicsByTab(tab string) ([]model.Topic, []model.Node, *model.User, error)
- func (c *Client) Login(username, password string) (*model.User, error)
- func (c *Client) Logout() error
- func (c *Client) Post(path string, data map[string]string) (*goquery.Document, error)
- func (c *Client) SetCookies(cookies []*http.Cookie)
- type NodeTopicsResult
Constants ¶
View Source
const ( BaseURL = "https://www.v2ex.com" UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client V2EX HTTP 客户端
func (*Client) GetCurrentUser ¶
GetCurrentUser 获取当前登录用户信息
func (*Client) GetTopicDetail ¶
GetTopicDetail 获取帖子详情和回复
func (*Client) GetTopicDetailPage ¶
GetTopicDetailPage 获取帖子详情和指定页码的回复
func (*Client) GetTopicsByNode ¶
func (c *Client) GetTopicsByNode(nodeCode string, page int) (*NodeTopicsResult, error)
GetTopicsByNode 按节点获取主题列表
func (*Client) GetTopicsByTab ¶
GetTopicsByTab 按 Tab 获取主题列表,同时返回二级节点列表和用户信息
func (*Client) SetCookies ¶
SetCookies 设置登录 Cookie
type NodeTopicsResult ¶
NodeTopicsResult 节点主题列表结果
Click to show internal directories.
Click to hide internal directories.