twitch

package
v0.0.0-...-1ee750c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 10 Imported by: 0

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 manages communication with the twitch API.

func Custom

func Custom(client *http.Client, clientID, apiURL, usherAPIURL string) Client

Custom returns a new twitch API client with custom API endpoints

func New

func New(client *http.Client, clientID string) Client

New returns a new twitch API client.

func (*Client) Clip

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

func (*Client) ClipVideo

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

func (*Client) M3U8

func (c *Client) M3U8(ctx context.Context, id string) ([]byte, error)

M3U8 retrieves the M3U8 file of a specific VOD.

func (*Client) VOD

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

Name retrieves the name of the video from a URL.

type Clip

type Clip struct {
	Broadcaster struct {
		DisplayName string `json:"displayName"`
	} `json:"broadcaster"`
	Title string `json:"title"`
	Game  struct {
		Name string `json:"name"`
	} `json:"game"`
}

type ClipVideo

type ClipVideo struct {
	Token struct {
		Signature string `json:"signature"`
		Value     string `json:"value"`
	} `json:"playbackAccessToken"`
	Qualities []struct {
		FrameRate float64 `json:"frameRate"`
		Quality   string  `json:"quality"`
		SourceURL string  `json:"sourceURL"`
	} `json:"videoQualities"`
}

type VOD

type VOD struct {
	Title string `json:"title"`
	Owner struct {
		DisplayName string `json:"displayName"`
	} `json:"owner"`
	Game struct {
		Name string `json:"name"`
	} `json:"game"`
}

VOD contains infos on a twitch VOD.

type VideoType

type VideoType int
const (
	TypeVOD VideoType = iota
	TypeClip
)

func ID

func ID(URL string) (string, VideoType, error)

ID extract the ID/slug and type from a VOD url.

Jump to

Keyboard shortcuts

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