book

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID           string
	Title        string
	CoverURL     string
	Description  string
	Author       string
	Category     Category
	Created      time.Time
	Updated      time.Time
	UpdateStatus UpdateStatus

	WordCount          uint64
	ChapterCount       uint64
	ClickCount         uint64
	RecommendCount     uint64
	BookmarkCount      uint64
	MonthlyTicketCount uint64
	BladeCount         uint64
	FanValue           uint64
	ReviewCount        uint64
	RewardCount        uint64

	MonthClickCount      uint64
	MonthNoVIPClickCount uint64
	MonthRecommendCount  uint64
	MonthBookmarkCount   uint64
	MonthFanValue        uint64

	WeekClickCount      uint64
	WeekNoVIPClickCount uint64
	WeekRecommendCount  uint64
	WeekBookmarkCount   uint64
	WeekFanValue        uint64

	TotalBladeCount         uint64
	TotalMonthlyTicketCount uint64

	LastChapter Chapter
	Tags        []Tag
}

func (*Book) Fetch

func (book *Book) Fetch(ctx context.Context) (ret gjson.Result, err error)

Fetch update book in-place and returns json response result.

type Category

type Category string
const (
	C全部   Category = "0"
	C灵异未知 Category = "1"
	C女频   Category = "11"
	C免费同人 Category = "24"
	C都市青春 Category = "27"
	C游戏竞技 Category = "3"
	C历史军事 Category = "30"
	C仙侠武侠 Category = "5"
	C科幻无限 Category = "6"
	C玄幻奇幻 Category = "8"
)

func CategoryByName added in v0.1.1

func CategoryByName(name string) Category

func (Category) String added in v0.1.1

func (c Category) String() string

type Chapter

type Chapter struct {
	ID     string
	BookID string
	Title  string
	Index  uint64

	Created time.Time
	Updated time.Time
}

type Expense

type Expense string
var (
	ExpenseUndefined Expense = ""
	ExpenseFree      Expense = "0"
	ExpensePaid      Expense = "1"
)

type OfficialTagsResult

type OfficialTagsResult struct {
	JSON gjson.Result
}

func OfficialTags

func OfficialTags(ctx context.Context) (ret OfficialTagsResult, err error)

func (OfficialTagsResult) Tags

func (res OfficialTagsResult) Tags() (ret []Tag)

type Order

type Order string
var (
	OAverageSale     Order = "average_buy"
	OMonthlyTicket   Order = "total_yp"
	OMonthNoVIPClick Order = "month_no_vip_click"
	OTotalBookmark   Order = "total_favor"
	OTotalClick      Order = "total_click"
	OTotalRecommend  Order = "total_recommend"
	OTotalWordCount  Order = "total_word_count"
	OUpdateTime      Order = "uptime"
	OWeekClick       Order = "week_click"
	OWeekNoVIPClick  Order = "week_no_vip_click"
)

type RankOption

type RankOption = func(opts *RankOptions)

func RankOptionCategory

func RankOptionCategory(category Category) RankOption

func RankOptionPageIndex

func RankOptionPageIndex(n int) RankOption

func RankOptionPageSize

func RankOptionPageSize(n int) RankOption

RankOptionPageSize, defaults to 10. max page size is 20 (2021-06-28)

type RankOptions

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

type RankPeriod

type RankPeriod string
var (
	// RPWeek means less than a week for some rank type.
	RPWeek  RankPeriod = "week"
	RPMonth RankPeriod = "month"
	RPTotal RankPeriod = "total"
)

type RankResult

type RankResult struct {
	JSON gjson.Result
}

func Rank

func Rank(ctx context.Context, rankType RankType, period RankPeriod, opts ...RankOption) (ret RankResult, err error)

func (RankResult) Books

func (res RankResult) Books() []Book

type RankType

type RankType string
var (
	// 点击
	RTClick RankType = "no_vip_click"
	// 畅销
	RTSales RankType = "fans_value"
	// 月票
	RTMonthlyTicket RankType = "yp"
	// 新书
	RTNewBook RankType = "yp_new"
	// 收藏
	RTBookmark RankType = "favor"
	// 推荐
	RTRecommend RankType = "recommend"
	// 刀片
	RTBlade RankType = "blade"
	// 更新
	RTWordCount RankType = "word_count"
	// 吐槽
	RTTsukkomi RankType = "tsukkomi"
	// 完本
	RTFinished RankType = "complet"
	// 追读
	RTWatching RankType = "track_read"
)

type SearchOption

type SearchOption = func(opts *SearchOptions)

func SearchOptionCategory

func SearchOptionCategory(category Category) SearchOption

func SearchOptionExpense

func SearchOptionExpense(expense Expense) SearchOption

func SearchOptionOrder

func SearchOptionOrder(order Order) SearchOption

func SearchOptionPageIndex

func SearchOptionPageIndex(n int) SearchOption

func SearchOptionPageSize

func SearchOptionPageSize(n int) SearchOption

SearchOptionPageSize specify result count, defaults to 10

func SearchOptionQuery

func SearchOptionQuery(query string) SearchOption

func SearchOptionTag

func SearchOptionTag(tags ...string) SearchOption

func SearchOptionUpdateStatus

func SearchOptionUpdateStatus(updateStatus UpdateStatus) SearchOption

func SearchOptionUpdateTime

func SearchOptionUpdateTime(updateTimeRange UpdateTimeRange) SearchOption

func SearchOptionWordCount

func SearchOptionWordCount(wordCountRange WordCountRange) SearchOption

type SearchOptions

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

SearchOptions contains merged SearchOption result

type SearchResult

type SearchResult struct {
	JSON gjson.Result
}
func Search(ctx context.Context, opts ...SearchOption) (ret SearchResult, err error)

func (SearchResult) Books

func (res SearchResult) Books() (ret []Book)

type Tag

type Tag struct {
	ID   string
	Name string
	Type string
}

type UpdateStatus

type UpdateStatus string
var (
	UpdateStatusUndefined   UpdateStatus = ""
	UpdateStatusNotFinished UpdateStatus = "0"
	UpdateStatusFinished    UpdateStatus = "1"
)

type UpdateTimeRange

type UpdateTimeRange string
var (
	UpdateTimeUndefined   UpdateTimeRange = ""
	UpdateTimeIn3Days     UpdateTimeRange = "1"
	UpdateTimeIn7Days     UpdateTimeRange = "2"
	UpdateTimeInHalfMonth UpdateTimeRange = "3"
	UpdateTimeInMonth     UpdateTimeRange = "4"
)

type WordCountRange

type WordCountRange string
var (
	WordCountUndefined   WordCountRange = ""
	WordCountLt300k      WordCountRange = "1"
	WordCountGt300kLt50k WordCountRange = "2"
	WordCountGt500kLt1m  WordCountRange = "3"
	WordCountGt1mLt2m    WordCountRange = "4"
	WordCountGt2m        WordCountRange = "5"
)

Jump to

Keyboard shortcuts

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