vimeo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockClient

func NewMockClient(mock MockRoundTripper) *http.Client

func NewMockReponseFromBytes

func NewMockReponseFromBytes(body []byte) *http.Response

func NewMockReponseFromString

func NewMockReponseFromString(body string) *http.Response

Types

type Audio

type Audio struct {
	Id          string    `json:"id"`
	BaseUrl     string    `json:"base_url"`
	Bitrate     int       `json:"bitrate"`
	InitSegment string    `json:"init_segment"`
	Segments    []Segment `json:"segments"`
}

func (*Audio) DecodedInitSegment

func (a *Audio) DecodedInitSegment() ([]byte, error)

type Client

type Client struct {
	Client    *http.Client
	UserAgent string
}

func NewClient

func NewClient() *Client

func (*Client) Download

func (c *Client) Download(url *url.URL, output io.Writer) error

func (*Client) GetMasterJson

func (c *Client) GetMasterJson(url *url.URL) (*MasterJson, error)

type MasterJson

type MasterJson struct {
	ClipId  string  `json:"clip_id"`
	BaseUrl string  `json:"base_url"`
	Video   []Video `json:"video"`
	Audio   []Audio `json:"audio"`
}

func (*MasterJson) AudioSegmentUrls

func (mj *MasterJson) AudioSegmentUrls(masterJsonUrl *url.URL, id string) ([]*url.URL, error)

func (*MasterJson) CreateAudioFile

func (mj *MasterJson) CreateAudioFile(output io.Writer, masterJsonUrl *url.URL, id string, client *Client) error

func (*MasterJson) CreateVideoFile

func (mj *MasterJson) CreateVideoFile(output io.Writer, masterJsonUrl *url.URL, id string, client *Client) error

func (*MasterJson) FindAudio

func (mj *MasterJson) FindAudio(id string) (*Audio, error)

func (*MasterJson) FindMaximumBitrateAudio

func (mj *MasterJson) FindMaximumBitrateAudio() *Audio

func (*MasterJson) FindMaximumBitrateVideo

func (mj *MasterJson) FindMaximumBitrateVideo() *Video

func (*MasterJson) FindVideo

func (mj *MasterJson) FindVideo(id string) (*Video, error)

func (*MasterJson) VideoSegmentUrls

func (mj *MasterJson) VideoSegmentUrls(masterJsonUrl *url.URL, id string) ([]*url.URL, error)

type MockRoundTripper

type MockRoundTripper func(req *http.Request) *http.Response

func (MockRoundTripper) RoundTrip

func (mock MockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Segment

type Segment struct {
	Url string `json:"url"`
}

type Video

type Video struct {
	Id          string    `json:"id"`
	BaseUrl     string    `json:"base_url"`
	Bitrate     int       `json:"bitrate"`
	InitSegment string    `json:"init_segment"`
	Segments    []Segment `json:"segments"`
}

func (*Video) DecodedInitSegment

func (v *Video) DecodedInitSegment() ([]byte, error)

Jump to

Keyboard shortcuts

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