weibo

package module
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

A Go library for Weibo tweet monitoring. 一个用于监测微博推文的 Go 库。

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadRequest = errors.New("BadRequest")

Functions

func DefaultCheck added in v1.1.2

func DefaultCheck() (check checkCookie)

func DownPic added in v1.1.1

func DownPic(c *Client, pic string, picUrl string, path string) error

func ExistedOrDownPic added in v1.1.1

func ExistedOrDownPic(c *Client, mblog *Mblog, path string) error

Types

type ActionInfo added in v1.1.3

type ActionInfo struct {
	Comment *Comment `json:"comment"`
}

type CMblog added in v1.1.3

type CMblog struct {
	CreatedAt   string      `json:"created_at"`
	ID          string      `json:"id"`
	Text        string      `json:"text"`
	PicIds      []string    `json:"pic_ids"`
	User        *User       `json:"user"`
	IsLongText  bool        `json:"isLongText"`
	ActionInfo  *ActionInfo `json:"action_info"`
	PicNum      int8        `json:"pic_num"`
	MblogID     string      `json:"bid"`
	Pics        []*Pics     `json:"pics,omitempty"`
	Retweeted   *CMblog     `json:"retweeted_status,omitempty"`
	LongTextRaw string
}

func (*CMblog) TheText added in v1.1.3

func (m *CMblog) TheText() string

type CMblogBody added in v1.1.3

type CMblogBody struct {
	Data struct {
		Cards []*Card `json:"cards"`
	} `json:"data"`
	Ok  int    `json:"ok"`
	Msg string `json:"msg,omitempty"`
}

type Card added in v1.1.3

type Card struct {
	CardType       int8         `json:"card_type"`
	ShowType       int8         `json:"show_Type"`
	SkipGroupTitle bool         `json:"skip_group_title,omitempty"`
	CardGroup      []*CardGroup `json:"card_group,omitempty"`
	Mblog          CMblog       `json:"mblog,omitempty"`
}

type CardGroup added in v1.1.3

type CardGroup struct {
	CardType int8   `json:"card_type"`
	ShowType int8   `json:"show_Type"`
	Mblog    CMblog `json:"mblog"`
}

type Client

type Client struct {
	Cookie string
	Proxy  string
	Check  checkCookie
}

func (*Client) AddFriend added in v1.1.2

func (c *Client) AddFriend(uid string) (err error)

func (*Client) CheckCookie added in v1.1.2

func (c *Client) CheckCookie() (isActivate bool, err error)

func (*Client) DownPics added in v1.1.0

func (c *Client) DownPics(mblog *Mblog, path string) error

func (*Client) DownPicsByUrl added in v1.1.5

func (c *Client) DownPicsByUrl(name []string, urls []string, path string) error

func (*Client) FetchCMblogLongText added in v1.1.3

func (c *Client) FetchCMblogLongText(mblog *CMblog) error

func (*Client) FetchMblogLongText

func (c *Client) FetchMblogLongText(mblog *Mblog) error

func (*Client) GetCMblogs added in v1.1.3

func (c *Client) GetCMblogs(userid string, page int, longtext bool) ([]*CMblog, error)

获取互动信息,需要cookie

func (*Client) GetComments added in v1.2.0

func (c *Client) GetComments(flow int, mid int64, userid string, isMax int, maxId int64, fetchLevel int, longtext bool) (*CommentBody, error)

GetComments - flow:0-按热度排序;1-按时间排序 - mid:博文的id;评论id - userid:用户id - isMix:0-首页;1-后续页,需要max_id参数(上一页返回JSON的max_id) - fetchLevel:0-博文下的评论;1-评论下的评论 - type:feed-简要

func (*Client) GetMMblogs added in v1.1.4

func (c *Client) GetMMblogs(userid string, page int, longtext bool) ([]*CMblog, error)

手机端api,获取全部微博,需要cookie

func (*Client) GetMblog added in v1.3.0

func (c *Client) GetMblog(mblogId string) (*Mblog, error)

func (*Client) GetMblogLongText

func (c *Client) GetMblogLongText(mblogid string) (longtext string, err error)

func (*Client) GetMblogs

func (c *Client) GetMblogs(userid string, page int, longtext bool) ([]*Mblog, error)

type Comment added in v1.1.3

type Comment struct {
	List  []*CommentBlog `json:"list"`
	Count int64          `json:"count"`
}

type CommentBlog added in v1.1.3

type CommentBlog struct {
	CreatedAt string `json:"created_at"`
	ID        int64  `json:"id"`
	Text      string `json:"text"`
	User      *User  `json:"user"`
}

type CommentBody added in v1.2.0

type CommentBody struct {
	Ok          int           `json:"ok"`
	Data        []*Comments   `json:"data"`
	RootComment []interface{} `json:"rootComment"`
	TotalNumber int           `json:"total_number"`
	TipMsg      string        `json:"tip_msg"`
	MaxId       int64         `json:"max_id"`
	TrendsText  string        `json:"trendsText"`
}

type Comments added in v1.2.0

type Comments struct {
	User                 *User         `json:"user"`
	CreatedAt            string        `json:"created_at"`
	Id                   int64         `json:"id"`
	Rootid               int64         `json:"rootid"`
	Rootidstr            string        `json:"rootidstr"`
	FloorNumber          int           `json:"floor_number"`
	Text                 string        `json:"text"`
	DisableReply         int           `json:"disable_reply"`
	RestrictOperate      int           `json:"restrictOperate"`
	SourceAllowclick     int           `json:"source_allowclick"`
	SourceType           int           `json:"source_type"`
	Source               string        `json:"source"`
	Mid                  string        `json:"mid"`
	Idstr                string        `json:"idstr"`
	UrlObjects           []interface{} `json:"url_objects"`
	Liked                bool          `json:"liked"`
	Readtimetype         string        `json:"readtimetype"`
	AnalysisExtra        string        `json:"analysis_extra"`
	SafeTags             int64         `json:"safe_tags"`
	MarkType             int           `json:"mark_type,omitempty"`
	MatchAiPlayPicture   bool          `json:"match_ai_play_picture"`
	Rid                  string        `json:"rid"`
	AllowFollow          bool          `json:"allow_follow"`
	ItemCategory         string        `json:"item_category"`
	Comments             []*Comments   `json:"comments"`
	ReplyComment         *Comments     `json:"reply_comment,omitempty"`
	MaxId                int64         `json:"max_id"`
	TotalNumber          int           `json:"total_number"`
	IsLikedByMblogAuthor bool          `json:"isLikedByMblogAuthor"`
	LikeCounts           int           `json:"like_counts"`
	MoreInfo             struct {
		Scheme        string `json:"scheme"`
		Text          string `json:"text"`
		HighlightText string `json:"highlight_text"`
	} `json:"more_info"`
	TextRaw string      `json:"text_raw"`
	Urls    []UrlStruct `json:"url_struct,omitempty"`
}

type Database

type Database struct {
	DN  string
	DSN string
	// contains filtered or unexported fields
}

func (*Database) AddMblog

func (database *Database) AddMblog(mblog *Mblog) error

func (*Database) Close

func (database *Database) Close()

func (*Database) HasMblog

func (database *Database) HasMblog(mblog *Mblog) (bool, error)

func (*Database) Migrate

func (database *Database) Migrate() error

type Large added in v1.1.3

type Large struct {
	Url string `json:"url"`
}

type LongtextBody

type LongtextBody struct {
	Data struct {
		LongTextContent string `json:"longTextContent"`
	} `json:"data"`
	Ok int `json:"ok"`
}

type Mblog

type Mblog struct {
	User         *User                  `json:"user"`
	CreatedAt    string                 `json:"created_at"`
	ID           int64                  `json:"id"`
	MblogID      string                 `json:"mblogid"`
	TextRaw      string                 `json:"text_raw"`
	Text         string                 `json:"text"`
	IsLongText   bool                   `json:"isLongText"`
	PicNum       int8                   `json:"pic_num"`
	PicIds       []string               `json:"pic_ids"`
	PicInfos     map[string]interface{} `json:"pic_infos"`
	MixMediaInfo map[string]interface{} `json:"mix_media_info"`
	Retweeted    *Mblog                 `json:"retweeted_status,omitempty"`
	Source       string                 `json:"source"`
	RegionName   string                 `json:"region_name"`
	Ok           int                    `json:"ok,omitempty"`
	LongTextRaw  string
}

func (*Mblog) PicUrls added in v1.1.1

func (m *Mblog) PicUrls() map[string]interface{}

func (*Mblog) String

func (mblog *Mblog) String() string

func (*Mblog) TheText

func (m *Mblog) TheText() string

type MymblogBody

type MymblogBody struct {
	Data struct {
		List []*Mblog `json:"list"`
	} `json:"data"`
	Ok int `json:"ok"`
}

type Pics added in v1.1.3

type Pics struct {
	Pid   string `json:"pid"`
	Url   string `json:"url"`
	Large *Large `json:"large"`
}

type UrlStruct added in v1.3.1

type UrlStruct struct {
	UrlTitle    string                 `json:"url_title"`
	UrlTypePic  string                 `json:"url_type_pic"`
	OriUrl      string                 `json:"ori_url"`
	ShortUrl    string                 `json:"short_url"`
	LongUrl     string                 `json:"long_url"`
	UrlType     int                    `json:"url_type"`
	Result      bool                   `json:"result"`
	StorageType string                 `json:"storage_type"`
	Hide        int                    `json:"hide"`
	ObjectType  string                 `json:"object_type"`
	Position    int                    `json:"position"`
	PicInfos    map[string]interface{} `json:"pic_infos"`
	PicIds      []string               `json:"pic_ids"`
	GifName     string                 `json:"gif_name"`
	H5TargetUrl string                 `json:"h5_target_url"`
	NeedSaveObj int                    `json:"need_save_obj"`
}

type User

type User struct {
	ID     int64  `json:"id"`
	Name   string `json:"screen_name"`
	Icon   string `json:"avatar_large"`
	Remark string `json:"remark"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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