spider

package
v0.0.0-...-562e60d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpiderClient *resty.Client

Functions

func New

func New() *resty.Client

Types

type BBS

type BBS struct {
	Region   Region `comment:"领域"`
	Uid      string `comment:"帖子id"`
	Title    string `comment:"标题"`
	Href     string `comment:"链接"`
	Label    string `comment:"标签"`
	ReplyCnt int    `comment:"回复"`
	ViewCnt  int    `comment:"浏览"`
	LightCnt int    `comment:"亮了"`
	Content  string `comment:"内容"`
	// Author   User   `comment:"作者"`
	Nickname string `comment:"作者"`
	PostTime string `comment:"发帖时间"`
}

func GetBBSList

func GetBBSList(region Region, page int) ([]BBS, error)

func NBAGetBBS

func NBAGetBBS(i int, s *goquery.Selection, region Region, page int) BBS

NBA/CBA获取帖子信息的方法 暂时不需要,使用类似步行街的页面了

func VoteGetBBS

func VoteGetBBS(i int, s *goquery.Selection, region Region, page int) BBS

湿乎乎、步行街等获取帖子信息的方法

func (*BBS) GetComments

func (bbs *BBS) GetComments(page int) ([]Comment, error)

func (*BBS) GetDetail

func (bbs *BBS) GetDetail() (string, error)

type Comment

type Comment struct {
	Uid       string
	Content   string `comment:"内容"`
	Location  string
	ReplyTime time.Time
	LightCnt  int
	Nickname  string
}

type GetBBSInfoFunc

type GetBBSInfoFunc func(i int, s *goquery.Selection, region Region, page int) BBS

type Region

type Region string
const (
	NBA        Region = "nba"
	CBA        Region = "cba"
	Vote       Region = "湿乎乎"
	TopicDaily Region = "步行街" // 步行街主干道

)

func (Region) GetBBS

func (r Region) GetBBS(i int, s *goquery.Selection, page int) BBS

获取帖子信息的方法

func (Region) GetBBSListSelector

func (r Region) GetBBSListSelector() string

对应帖子列表的selector

func (Region) String

func (r Region) String() string

返回链接中对应的region部分, https://bbs.hupu.com/<region>

Jump to

Keyboard shortcuts

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