site

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Sitepool = []SiteA{
	dingdian,
	biquge2,
	biquge3,
}

Functions

func BookInfo

func BookInfo(BookURL string) (s *store.Store, err error)

BookInfo 获取小说信息

func Chapter

func Chapter(BookURL string) (content []string, err error)

Chapter 获取小说章节内容

func ChromedpBookInfo

func ChromedpBookInfo(BookURL string, logfile string) (s *store.Store, err error)

func ClosePhantomJS

func ClosePhantomJS()

func InitPhantomJS

func InitPhantomJS()

func PhBookInfo

func PhBookInfo(BookURL string) (s *store.Store, err error)

func PhChapter

func PhChapter(BookURL string) (content []string, err error)

func SingleSpace added in v0.1.2

func SingleSpace(s string) (r string)

func Type1BookInfo added in v0.1.3

func Type1BookInfo(nameExpr, coverExpr, authorExpr, chapterExpr string) func(body io.Reader) (s *store.Store, err error)

Type1BookInfo 书籍信息页,单页,无翻页,无分卷

func Type1Chapter added in v0.1.3

func Type1Chapter(expr string) func(body io.Reader) ([]string, error)

func Type1Search added in v0.1.3

func Type1Search(
	URL string,
	getReq func(s string) *http.Request,
	resultExpr, nameExpr, authorExpr string) func(s string) (result []ChaperSearchResult, err error)

Type1Search 搜索类型1: 搜索后得到302跳转或者列表的

func Type1SearchAfter added in v0.1.3

func Type1SearchAfter(
	URL string,
	getReq func(s string) *http.Request,
	resultExpr, nameExpr, authorExpr string,
	after func(r ChaperSearchResult) ChaperSearchResult) func(s string) (result []ChaperSearchResult, err error)

Type1SearchAfter 搜索类型1: 搜索后得到302跳转或者列表的

func Type2Chapter added in v0.1.3

func Type2Chapter(expr string, next func(doc *html.Node) *html.Node, block func([]string) []string) func(body io.Reader) ([]string, error)

Type2Chapter 章节匹配2:单章分多页, next函数返回下一个页面的DOM block函数用于屏蔽多余的段落

Types

type ChaperSearchResult added in v0.1.2

type ChaperSearchResult struct {
	BookName string
	Author   string
	BookURL  string
}
func Search(s string) (result []ChaperSearchResult, err error)

type ErrMethodMissing added in v0.1.2

type ErrMethodMissing struct {
	Site *SiteA
}

func (ErrMethodMissing) Error added in v0.1.2

func (e ErrMethodMissing) Error() string

type ErrUnsupportSite

type ErrUnsupportSite struct {
	Site string
}

func (ErrUnsupportSite) Error

func (e ErrUnsupportSite) Error() string

type SearchFunc added in v0.1.3

type SearchFunc func(s string) (result []ChaperSearchResult, err error)

type SiteA added in v0.1.2

type SiteA struct {
	Name     string // 站点名称
	HomePage string // 站点首页

	File string

	// match url, look that https://godoc.org/path#Match
	Match []string

	// search book on site
	Search func(s string) (result []ChaperSearchResult, err error)

	// parse fiction info by page body
	BookInfo func(body io.Reader) (s *store.Store, err error)

	// parse fiction chaper content by page body
	Chapter func(body io.Reader) (content []string, err error)
}

func MatchOne added in v0.1.2

func MatchOne(pool []SiteA, u string) (*SiteA, error)

MatchOne match one site, is use `MatchSites` first result

func MatchSites added in v0.1.2

func MatchSites(pool []SiteA, u string) ([]SiteA, error)

MatchSites match all site

Jump to

Keyboard shortcuts

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