audible

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Regions = []*Region{
	{"Australia", "com.au"},
	{"Canada", "ca"},
	{"France", "fr"},
	{"Germany", "de"},
	{"India", "in"},
	{"Italy", "it"},
	{"Japan", "co.jp"},
	{"United Kingdom", "co.uk"},
	{"United States", "com"},
}

Functions

Types

type Book

type Book struct {
	Title        string
	Authors      []string
	Narrators    []string
	Duration     time.Duration
	DownloadURLs map[string]string
	ThumbURL     string
	ThumbImage   image.Image `json:"-"`
	AudibleURL   string
	LocalPath    string
}

func (*Book) ID

func (b *Book) ID() string

func (*Book) WriteInfo

func (b *Book) WriteInfo(w io.Writer) error

type ByTitle

type ByTitle []*Book

ByTitle implements sort.Interface for []*Book based on the Title field

func (ByTitle) Len

func (a ByTitle) Len() int

func (ByTitle) Less

func (a ByTitle) Less(i, j int) bool

func (ByTitle) Swap

func (a ByTitle) Swap(i, j int)

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Option) (*Client, error)

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) error

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) GetActivationBytes

func (c *Client) GetActivationBytes(ctx context.Context) ([]byte, error)

func (*Client) GetLibrary

func (c *Client) GetLibrary(ctx context.Context) ([]*Book, error)

func (*Client) GetPlayerToken

func (c *Client) GetPlayerToken(ctx context.Context) (string, error)

type Option

type Option func(*Client)

func OptionAuthCode

func OptionAuthCode(getAuthCode func() string) Option

func OptionBaseURL

func OptionBaseURL(baseURL string) Option

func OptionCaptcha

func OptionCaptcha(getCaptcha func(imgURL string) string) Option

func OptionPassword

func OptionPassword(password string) Option

func OptionPlayerID

func OptionPlayerID(playerID string) Option

func OptionPromptChoice

func OptionPromptChoice(getChoice func(msg string, opts []string) int) Option

func OptionUsername

func OptionUsername(username string) Option

type Page

type Page struct {
	Books       []*Book
	NextPageURL string
}

type Region

type Region struct {
	Name string
	TLD  string
}

Jump to

Keyboard shortcuts

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