client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlibustaHostEnvKey = "FLIBUSTA_HOST"
	Fb2                = "fb2"
	Epub               = "epub"
	Mobi               = "mobi"
)

Variables

View Source
var (
	FlibustaMirrors = []string{
		"flibusta.is",
		"flibusta.site",
		"flibustahezeous3.onion",
	}

	TorproxySuggest = `docker run -it -p 8118:8118 -p 9050:9050 -d dperson/torproxy`
)
View Source
var (
	ItemInListIdRe        = regexp.MustCompile(`[0-9]+$`)
	ItemInDescriptionIdRe = regexp.MustCompile(`b/([0-9]+)/read$`)
)
View Source
var HostRe = regexp.MustCompile(`(?P<Scheme>https?)?(://)?(?P<Host>[0-8a-z.]+):?(?P<Port>[0-9]+)?/?`)

Functions

func ParseSearch

func ParseSearch(stream io.Reader) (result *[]ListItem, err error)

Types

type DownloadResult

type DownloadResult struct {
	Name string
	File []byte
}

type FlibustaClient

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

func FromEnv

func FromEnv() (*FlibustaClient, error)

func (*FlibustaClient) Download

func (c *FlibustaClient) Download(id string, bookFormat string) (result *DownloadResult, err error)

func (*FlibustaClient) Info added in v0.2.0

func (c *FlibustaClient) Info(id string, respProcessor func(stream io.Reader) (result *InfoResult, err error)) (result *InfoResult, err error)

func (*FlibustaClient) Search

func (c *FlibustaClient) Search(searchQuery string, respProcessor func(stream io.Reader) (*[]ListItem, error)) (result *[]ListItem, err error)

type Headers added in v0.2.0

type Headers map[string]string

type InfoResult added in v0.2.0

type InfoResult struct {
	ID         string
	Title      string
	Genre      string
	Annotation string
	Size       string
	Formats    []string
}

func ParseInfo added in v0.2.0

func ParseInfo(stream io.Reader) (result *InfoResult, err error)

func (*InfoResult) String added in v0.2.0

func (info *InfoResult) String() string

type ListItem

type ListItem struct {
	Title   string
	Authors []string
	ID      string
}

func (*ListItem) String

func (item *ListItem) String() string

type ResponseResult added in v0.2.0

type ResponseResult struct {
	Host     string
	Response *http.Response
	Error    error
}

Jump to

Keyboard shortcuts

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