falseknees

package module
v0.0.0-...-ce2b19e Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 9 Imported by: 0

README

FalseKnees

This is definitely not real API for FalseKnees.

By that I mean to say FK does not have an API, so this is a glorified HTML parser.

Please be considerate of the fact that this is not a real API and so it is pulling entire HTML pages to parse.

Current Comic

FalseKnees /index.html page contains a redirect to get the latest comic number. This library leverages that page to get the current comic, however in an effort to reduce HTTP calls against full HTML pages, the library has a built-in interval of 30 minutes.

This means that if you get the current comic at 12:00 and FK adds a new comic at 12:05, you won't get the new current comic until 12:30.

Currently the following funcs retrieve the current comic number:

  • Random
  • Current

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a FalseKnees client

func New

func New(opts ...ClientOption) *Client

New returns a new Client

func (*Client) Comic

func (c *Client) Comic(ctx context.Context, num int) (*Comic, error)

Comic returns a specific Comic

func (*Client) Current

func (c *Client) Current(ctx context.Context) (*Comic, error)

Current returns the current Comic

func (*Client) Random

func (c *Client) Random(ctx context.Context) (*Comic, error)

Random returns a random Comic

type ClientOption

type ClientOption func(*Client)

ClientOption is options for a Client

func WithHTTP

func WithHTTP(client *http.Client) ClientOption

WithHTTP is a ClientOption for using a different http.Client

type Comic

type Comic struct {
	Num   int
	Title string
	Img   string
}

Comic is a FalseKnees comic

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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