youtube_sub_dl

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

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

Youtube Subtitle Downloader

This is a simple youtube subtitle downloader. Any contribution is welcomed!

Usage

func main(){
    y, err := NewYoutubeDownloader(url)
	if err != nil {
		log.Fatal(err)
    }
    subtitle, err := y.Download()
    if err != nil {
        log.Fatal(err)
    }
    for _, line := range subtitle.Lines {
        // fmt.Println(line.Start, line.End, line.Text)
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	Start time.Duration
	End   time.Duration
	Text  string
	Index int // zero-based
}

type Subtitle

type Subtitle struct {
	Lines []Line
}

func Download

func Download(url string) (*Subtitle, error)

type YoutubeDownloader

type YoutubeDownloader struct {
	URL       string
	VideoID   string
	Languages map[string]string
}

func NewYoutubeDownloader

func NewYoutubeDownloader(URL string) (*YoutubeDownloader, error)

func (*YoutubeDownloader) Download

func (y *YoutubeDownloader) Download() (*Subtitle, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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