Documentation
¶
Index ¶
- Constants
- Variables
- func BuildBookURL(domain, bookID string) string
- func BuildDownloadsPageURL(domain string, page int) string
- func BuildDownloadsURL(domain string) string
- func BuildFullTextSearchURL(domain, query, searchType string) string
- func BuildHistoryURL(domain string, page int) string
- func BuildSearchURL(domain, query string) string
- func CurrentDefaultDomain() string
- func SendToKindle(filePath string, cfg KindleConfig, smtpPassword string) error
- func SetDefaultDomain(domain string)
- type Book
- type Booklist
- type BooklistResult
- type Client
- func (c *Client) Cookies() map[string]string
- func (c *Client) Domain() string
- func (c *Client) Download(downloadURL, destDir string, progressFn func(written, total int64)) (DownloadResult, error)
- func (c *Client) DownloadHistory(page int) (DownloadHistoryResult, error)
- func (c *Client) DownloadWithContext(ctx context.Context, downloadURL, destDir string, ...) (DownloadResult, error)
- func (c *Client) FetchBook(id string) (Book, error)
- func (c *Client) FetchBookDetails(ids []string) map[string]Book
- func (c *Client) FullTextSearch(query string, page, count int, opts *FullTextSearchOptions) (SearchResult, error)
- func (c *Client) GetLimits() (DownloadLimit, error)
- func (c *Client) Login(email, password string) error
- func (c *Client) Logout()
- func (c *Client) Search(query string, page, count int, opts *SearchOptions) (SearchResult, error)
- func (c *Client) SetCookies(cookies map[string]string)
- func (c *Client) SetDomain(domain string)
- type ClientOption
- type DownloadHistoryItem
- type DownloadHistoryResult
- type DownloadLimit
- type DownloadResult
- type Extension
- type FullTextSearchOptions
- type KindleConfig
- type Language
- type OrderOption
- type SearchOptions
- type SearchResult
Constants ¶
View Source
const ( DefaultDomain = "https://z-lib.sk" TorDomain = "http://bookszlibb74ugqojhzhg2a63w5i2atv5bqarulgczawnbmsb6s6qead.onion" EnvDomain = "ZLIB_DOMAIN" EnvProxy = "ZLIB_PROXY" )
Variables ¶
View Source
var ( ErrLoginFailed = errors.New("zlibrary: login failed") ErrNotLoggedIn = errors.New("zlibrary: not logged in, call Login first") ErrNoDomain = errors.New("zlibrary: no working domain found") ErrEmptyQuery = errors.New("zlibrary: search query is empty") ErrNoID = errors.New("zlibrary: no book ID provided") ErrInvalidProxy = errors.New("zlibrary: proxy_list must be a non-empty slice") ErrParseFailed = errors.New("zlibrary: failed to parse page") ErrSessionExpired = errors.New("zlibrary: session expired, run `zlib login` to re-authenticate") ErrPhraseMinWords = errors.New("zlibrary: phrase search requires at least 2 words") )
View Source
var ( Version = "dev" Commit = "none" Date = "unknown" )
Functions ¶
func BuildBookURL ¶
func BuildDownloadsPageURL ¶
func BuildDownloadsURL ¶
func BuildFullTextSearchURL ¶
func BuildHistoryURL ¶
func BuildSearchURL ¶
func CurrentDefaultDomain ¶
func CurrentDefaultDomain() string
func SendToKindle ¶
func SendToKindle(filePath string, cfg KindleConfig, smtpPassword string) error
func SetDefaultDomain ¶
func SetDefaultDomain(domain string)
Types ¶
type Book ¶
type Book struct {
ID string `json:"id"`
ISBN string `json:"isbn,omitempty"`
URL string `json:"url"`
Cover string `json:"cover,omitempty"`
Name string `json:"name"`
Authors []string `json:"authors,omitempty"`
Publisher string `json:"publisher,omitempty"`
Year string `json:"year,omitempty"`
Language string `json:"language,omitempty"`
Extension string `json:"extension,omitempty"`
Size string `json:"size,omitempty"`
Rating string `json:"rating,omitempty"`
Quality string `json:"quality,omitempty"`
Description string `json:"description,omitempty"`
Categories string `json:"categories,omitempty"`
Edition string `json:"edition,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
}
type BooklistResult ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
func (*Client) Download ¶
func (c *Client) Download(downloadURL, destDir string, progressFn func(written, total int64)) (DownloadResult, error)
func (*Client) DownloadHistory ¶
func (c *Client) DownloadHistory(page int) (DownloadHistoryResult, error)
func (*Client) DownloadWithContext ¶
func (*Client) FullTextSearch ¶
func (c *Client) FullTextSearch(query string, page, count int, opts *FullTextSearchOptions) (SearchResult, error)
func (*Client) GetLimits ¶
func (c *Client) GetLimits() (DownloadLimit, error)
func (*Client) Search ¶
func (c *Client) Search(query string, page, count int, opts *SearchOptions) (SearchResult, error)
func (*Client) SetCookies ¶
type ClientOption ¶
type ClientOption func(*Client)
func WithDomain ¶
func WithDomain(domain string) ClientOption
func WithOnion ¶
func WithOnion(proxyURL string) ClientOption
func WithProxy ¶
func WithProxy(proxyURL string) ClientOption
type DownloadHistoryItem ¶
type DownloadHistoryResult ¶
type DownloadHistoryResult struct {
Items []DownloadHistoryItem `json:"items"`
Page int `json:"page"`
TotalPages int `json:"total_pages"`
}
type DownloadLimit ¶
type DownloadResult ¶
type FullTextSearchOptions ¶
type FullTextSearchOptions struct {
SearchOptions
Phrase bool
}
type KindleConfig ¶
type KindleConfig struct {
To string `json:"to"`
From string `json:"from"`
SMTPHost string `json:"smtp_host"`
SMTPPort int `json:"smtp_port"`
}
func (KindleConfig) Validate ¶
func (c KindleConfig) Validate() error
type Language ¶
type Language string
const ( LangEnglish Language = "english" LangChinese Language = "chinese" LangRussian Language = "russian" LangFrench Language = "french" LangGerman Language = "german" LangSpanish Language = "spanish" LangJapanese Language = "japanese" LangKorean Language = "korean" LangItalian Language = "italian" LangPortuguese Language = "portuguese" LangArabic Language = "arabic" LangDutch Language = "dutch" LangPolish Language = "polish" LangTurkish Language = "turkish" LangHindi Language = "hindi" )
type OrderOption ¶
type OrderOption string
const ( OrderPopular OrderOption = "popular" OrderNewest OrderOption = "date_created" OrderRecent OrderOption = "date_updated" )
func (OrderOption) String ¶
func (o OrderOption) String() string
type SearchOptions ¶
type SearchResult ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.





