vcat

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 9 Imported by: 1

README

vcat

Vcat helps you save YouTube video transcriptions without the need of an API key. Just like cat(1), but for YouTube videos.

Usage

Printing out the transcription JSON to stdout.
> vcat -u "url" --pretty
# {
#   "data": [
#     {
#       "start": "00:00:01",
#       "end": "00:00:04",
#       "duration": 3.78,
#       "text": "more recent thoughts on crypto after"
#     },
#     {
#       "start": "00:00:03",
#       "end": "00:00:07",
#       "duration": "4.981",
#       "text": "Banks not working not really"
#     },
#     ...
#}
List available transcriptions:
> vcat -l -u "url"
# [{Afrikaans af} {Akan ak} {Albanian sq} {Amharic am} {Arabic ar} {Armenian hy}
# {Assamese as} {Aymara ay} {Azerbaijani az} {Bangla bn} {Basque eu} {Belarusian be}
# {Bhojpuri bho} {Bosnian bs} {Bulgarian bg} {Burmese my} {Catalan ca} {Cebuano ceb}
# {Chinese (Simplified) zh-Hans} {Chinese (Traditional) zh-Hant} {Corsican co} {Croatian hr}
# {Czech cs} {Danish da} {Divehi dv} {Dutch nl} {English en} {Esperanto eo} {Estonian et}
# {Ewe ee} {Filipino fil} {Finnish fi} {French fr} {Galician gl} {Ganda lg} {Georgian ka}
# {German de} {Greek el} {Guarani gn} {Gujarati gu} {Haitian Creole ht} {Hausa ha}
# {Hawaiian haw} {Hebrew iw} {Hindi hi} {Hmong hmn} {Hungarian hu} {Icelandic is}
# {Igbo ig} {Indonesian id} {Irish ga} {Italian it} {Japanese ja} {Javanese jv} {Kannada kn}
# ...
# ]
Specify a different transcription language:
> vcat --language="cs" -u "url"
Save to file:
> vcat -o tmp/file.json -u "url"
Work with a CSV:
> vcat -u "url" --format csv
# start,end,duration,text
# 00:00:01,00:00:04,3.78,more recent thoughts on crypto after
# 00:00:03,00:00:07,4.98,Banks not working not really

Install

From source
> git clone git@github.com:hum/vcat.git
> cd vcat
> make build
> ./bin/vcat -u [URL]
With Go Install
> go install github.com/hum/vcat/cmd/vcat@latest
> vcat -u [URL]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailableLanguage

type AvailableLanguage struct {
	// Full name of the language translation, e.g. "English"
	Name string `json:"name"`

	// Code representation of the language's name, e.g. "en"
	Code string `json:"code"`
}

AvailableLanguage holds the available translation data of transcripts provided by YouTube

func GetAvailableLanguages

func GetAvailableLanguages(url string) ([]AvailableLanguage, error)

type Transcript

type Transcript struct {
	XMLName xml.Name `xml:"transcript" json:"-"`
	Text    []struct {
		XMLName  xml.Name `xml:"text" json:"-"`
		Start    string   `xml:"start,attr" json:"start"` // Start time of the text
		End      string   `json:"end"`
		Duration float64  `xml:"dur,attr" json:"duration"` // Approximate duration of the speech in `text`
		Text     string   `xml:",innerxml" json:"text"`    // The text being said in the current time bucket
	} `xml:"text" json:"data"`
}

Transcript is the underlying structure for processing the raw data of the transcript. It is used both as a serializing entity and as an output entity.

func GetTranscription

func GetTranscription(url string, language string) (*Transcript, error)

Directories

Path Synopsis
cmd
vcat command

Jump to

Keyboard shortcuts

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