transcript

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptionsData

type CaptionsData struct {
	CaptionTracks []struct {
		BaseURL string `json:"baseUrl"`
		Name    struct {
			SimpleText string `json:"simpleText"`
		} `json:"name"`
		LanguageCode string `json:"languageCode"`
		Kind         string `json:"kind"`
	} `json:"captionTracks"`
}

CaptionsData represents the YouTube captions JSON structure

type ErrNoTranscriptFound

type ErrNoTranscriptFound struct{ VideoID string }

func (ErrNoTranscriptFound) Error

func (e ErrNoTranscriptFound) Error() string

type ErrTranscriptsDisabled

type ErrTranscriptsDisabled struct{ VideoID string }

Custom error types

func (ErrTranscriptsDisabled) Error

func (e ErrTranscriptsDisabled) Error() string

type InnerTubeContext added in v0.9.1

type InnerTubeContext struct {
	Client struct {
		ClientName    string `json:"clientName"`
		ClientVersion string `json:"clientVersion"`
	} `json:"client"`
}

InnerTubeContext represents the YouTube InnerTube API context

type InnerTubeRequest added in v0.9.1

type InnerTubeRequest struct {
	Context InnerTubeContext `json:"context"`
	VideoID string           `json:"videoId"`
}

InnerTubeRequest represents the request to YouTube's InnerTube API

type InnerTubeResponse added in v0.9.1

type InnerTubeResponse struct {
	Captions struct {
		PlayerCaptionsTracklistRenderer struct {
			CaptionTracks []struct {
				BaseURL string `json:"baseUrl"`
				Name    struct {
					Runs []struct {
						Text string `json:"text"`
					} `json:"runs"`
				} `json:"name"`
				LanguageCode string `json:"languageCode"`
				Kind         string `json:"kind,omitempty"`
			} `json:"captionTracks"`
		} `json:"playerCaptionsTracklistRenderer"`
	} `json:"captions"`
	PlayabilityStatus struct {
		Status string `json:"status"`
		Reason string `json:"reason,omitempty"`
	} `json:"playabilityStatus"`
}

InnerTubeResponse represents the response from YouTube's InnerTube API

type TranscriptFetcher

type TranscriptFetcher struct {
	// contains filtered or unexported fields
}

TranscriptFetcher handles fetching transcripts from YouTube

func NewTranscriptFetcher

func NewTranscriptFetcher() *TranscriptFetcher

func (*TranscriptFetcher) Fetch

func (f *TranscriptFetcher) Fetch(videoURL string) (string, []TranscriptResponse, error)

type TranscriptResponse

type TranscriptResponse struct {
	Text     string  `json:"text"`
	Start    float64 `json:"start"`
	Duration float64 `json:"duration"`
}

TranscriptResponse represents a single caption entry

Jump to

Keyboard shortcuts

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