youtube

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: MIT Imports: 11 Imported by: 0

README

Youtube API

A youtube library for golang projects

Test

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caption

type Caption struct {
	Vid        string         `json:"vid"`
	Name       string         `json:"name"`
	LangCode   string         `json:"lang_code"`
	LangOrigin string         `json:"lang_original"`
	LangTrans  string         `json:"lang_translated"`
	IsDefault  bool           `json:"lang_default"`
	IsTrans    bool           `json:"translated"`
	Tracks     []CaptionTrack `json:"tracks"`
}

Caption for one video

func VideoCaptions

func VideoCaptions(ctx context.Context, vid string) ([]*Caption, error)

VideoCaptions returns video's captions

func VideoMetaCaption

func VideoMetaCaption(ctx context.Context, meta CaptionMeta) (*Caption, error)

VideoMetaCaption returns video's caption through metadata

func VideoTranslateCaption

func VideoTranslateCaption(ctx context.Context, meta CaptionMeta, tlang string) (*Caption, error)

VideoTranslateCaption translate a caption to target language

type CaptionMeta

type CaptionMeta struct {
	Vid        string `json:"vid"`
	Name       string `json:"name"`
	LangCode   string `json:"langCode"`
	LangOrigin string `json:"langOriginal"`
	LangTrans  string `json:"langTranslated"`
	IsDefault  bool   `json:"isDefault"`
}

CaptionMeta the metadata of caption

func CaptionMetas

func CaptionMetas(ctx context.Context, vid string) ([]CaptionMeta, error)

CaptionMetas list all captions related to video

type CaptionTrack

type CaptionTrack struct {
	Start    int    `json:"start"`
	Duration int    `json:"duration"`
	Text     string `json:"text"`
}

CaptionTrack is a single caption track

type VideoCaptionInfo

type VideoCaptionInfo struct {
	Tracks       []videoCaptionInfoTrack `json:"tracks"`
	Translations []string                `json:"translations"`
}

VideoCaptionInfo ...

type VideoInfo

type VideoInfo struct {
	ID         string           `json:"vid"`
	Title      string           `json:"title"`
	Author     string           `json:"author"`
	Channel    string           `json:"channel"`
	Desc       string           `json:"description"`
	ViewCount  int              `json:"viewCount"`
	IsLive     bool             `json:"isLiveContent"`
	Caption    VideoCaptionInfo `json:"caption"`
	Thumbnails []VideoThumbnail `json:"thumbnails"`
}

VideoInfo the information of Video

func GetVideoInfo

func GetVideoInfo(ctx context.Context, vid string) (*VideoInfo, error)

GetVideoInfo returns the video's information

type VideoThumbnail

type VideoThumbnail struct {
	Url    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

VideoThumbnail ...

Directories

Path Synopsis
cmd
youtube command

Jump to

Keyboard shortcuts

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