platform

package
v0.0.0-...-de7ae53 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLoginTimeOut = 120
View Source
const XHSLimitCount = 20

Variables

View Source
var (
	XhsBasUrl  = "https://www.xiaohongshu.com"
	ApiBaseUrl = "https://edith.xiaohongshu.com"
)
View Source
var XHSPageCount = 1

Functions

func IntToBase36

func IntToBase36(num *big.Int) string

Types

type ConvertCookiesResp

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

func ConvertCookies

func ConvertCookies(cookies []playwright.Cookie) (ConvertCookiesResp, error)

ConvertCookies The following code is used to convert playwright cookie into a custom pattern

type Note

type Note struct {
}

type NoteSearchResult

type NoteSearchResult struct {
	HasMore bool   `json:"has_more"`
	Items   []Note `json:"items"`
}

type ReadNoteCore

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

func (*ReadNoteCore) CreateXhsClient

func (core *ReadNoteCore) CreateXhsClient() *XhsApiClient

func (*ReadNoteCore) InitConfig

func (core *ReadNoteCore) InitConfig(loginType string)

func (*ReadNoteCore) Search

func (core *ReadNoteCore) Search()

func (*ReadNoteCore) Start

func (core *ReadNoteCore) Start()

type SampleCookie

type SampleCookie struct {
	Name  string
	Value string
}

type SearchNoteType

type SearchNoteType int
const (
	ALL SearchNoteType = iota
	VIDEO
	IMAGE
)

type SearchSortType

type SearchSortType string
const (
	GENERAL SearchSortType = "general"
	POPULAR SearchSortType = "popularity_descending"
	LATEST  SearchSortType = "time_descending"
)

type SearchXhsNoteParams

type SearchXhsNoteParams struct {
	Keyword  string         `json:"keyword"`
	Page     int            `json:"page"`
	PageSize int            `json:"page_size"`
	Sort     SearchSortType `json:"sort"`
	NoteType SearchNoteType `json:"note_type"`
	SearchId string         `json:"search_id"`
}

type XhsApiClient

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

XhsApiClient Packaged api client based on xhs

func (*XhsApiClient) GetNoteByKeyword

func (api *XhsApiClient) GetNoteByKeyword(searchParams SearchXhsNoteParams) (NoteSearchResult, error)

GetNoteByKeyword get note list by search keywords

func (*XhsApiClient) Ping

func (api *XhsApiClient) Ping() bool

Ping xhs api pong before execute search note ...

func (*XhsApiClient) UpdateCookies

func (api *XhsApiClient) UpdateCookies(ctx playwright.BrowserContext)

UpdateCookies will call this method when invalid login

type XhsHttpClient

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

XhsHttpClient Packaged httpclient based on xhs

func (*XhsHttpClient) Get

func (c *XhsHttpClient) Get(uri string, params map[string]string) (*http.Response, error)

func (*XhsHttpClient) Post

func (c *XhsHttpClient) Post(uri string, body []byte) (*http.Response, error)

func (*XhsHttpClient) PreHeaders

func (c *XhsHttpClient) PreHeaders(uri string, body []byte) map[string]interface{}

type XhsLogin

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

func (*XhsLogin) Begin

func (xl *XhsLogin) Begin()

func (*XhsLogin) CheckLoginState

func (xl *XhsLogin) CheckLoginState(noLoginWebSession string, loginFlag chan<- bool)

CheckLoginState polling check login state

func (*XhsLogin) LoginByCookies

func (xl *XhsLogin) LoginByCookies()

LoginByCookies login use cookies

func (*XhsLogin) LoginByQrcode

func (xl *XhsLogin) LoginByQrcode()

LoginByQrcode login by scan qrcode image

Jump to

Keyboard shortcuts

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