kindle

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAmazonURL = "https://www.amazon.com"

Variables

View Source
var (
	DefaultClient = &Client{
		client:    http.DefaultClient,
		amazonUrl: utils.CloneURL(defaultAmazonURL),
	}
)

Functions

This section is empty.

Types

type Book

type Book struct {
	ASIN        string
	Format      string
	Title       string
	Author      string
	Cover       string
	PublishDate *time.Time
}

func BookFromHTML

func BookFromHTML(bookNode *html.Node) *Book

BookFromHTML parses a book from the html of a result on the search results page. If a result is not for a book, nil will is returned.

func BooksFromHTML

func BooksFromHTML(searchNode *html.Node) ([]Book, error)

BooksFromHTML parses the books from the html of a search results page.

type Client

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

func NewClient

func NewClient(client *http.Client, countryCode *string) (*Client, error)

If client is nil, the default http client will be used. If country code is nil or unset, amazon.com will be used as the url. Will return an error if the country code is invalid.

func (*Client) Search

func (c *Client) Search(ctx context.Context, title string, author *string) ([]Book, error)

func (*Client) URL

func (c *Client) URL() *url.URL

URL returns a clone of of the amazon url used by the client

Jump to

Keyboard shortcuts

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