onlinestream

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpisodeDetails

type EpisodeDetails struct {
	// "ID" of the extension.
	Provider string `json:"provider"`
	// ID is the episode slug.
	// e.g. "the-apothecary-diaries-18578".
	ID string `json:"id"`
	// Episode number.
	// From 0 to n.
	Number int `json:"number"`
	// Episode page URL.
	URL string `json:"url"`
	// Episode title.
	// Leave it empty if the episode title is not available.
	Title string `json:"title,omitempty"`
}

EpisodeDetails contains the episode information from a provider. It is obtained by scraping the list of episodes.

type EpisodeServer

type EpisodeServer struct {
	// "ID" of the extension.
	Provider string `json:"provider"`
	// Episode server name.
	// e.g. "vidcloud".
	Server string `json:"server"`
	// HTTP headers for the video request.
	Headers map[string]string `json:"headers"`
	// Video sources for the episode.
	VideoSources []*VideoSource `json:"videoSources"`
}

EpisodeServer contains the server, headers and video sources for an episode.

type Provider

type Provider interface {
	Search(opts SearchOptions) ([]*SearchResult, error)
	// FindEpisodes returns the episodes for the given anime ID.
	FindEpisodes(id string) ([]*EpisodeDetails, error)
	// FindEpisodeServer returns the episode server for the given episode.
	// The "server" argument can be "default"
	FindEpisodeServer(episode *EpisodeDetails, server string) (*EpisodeServer, error)
	// GetSettings returns the provider settings.
	GetSettings() Settings
}

type SearchOptions added in v0.5.0

type SearchOptions struct {
	Query string `json:"query"`
	// Whether to search for subbed or dubbed anime.
	Dub bool `json:"dub"`
	// The year the anime was released.
	// Will be 0 if the year is not available.
	Year int `json:"year"`
}

type SearchResult

type SearchResult struct {
	// ID is the anime slug.
	// It is used to fetch the episode details.
	ID string `json:"id"`
	// Title is the anime title.
	Title string `json:"title"`
	// URL is the anime page URL.
	URL      string   `json:"url"`
	SubOrDub SubOrDub `json:"subOrDub"`
}

type Settings added in v0.4.5

type Settings struct {
	EpisodeServers []string `json:"episodeServers"`
	SupportsDub    bool     `json:"supportsDub"`
}

type SubOrDub

type SubOrDub string
const (
	Sub       SubOrDub = "sub"
	Dub       SubOrDub = "dub"
	SubAndDub SubOrDub = "both"
)

type VideoExtractor

type VideoExtractor interface {
	Extract(uri string) ([]*VideoSource, error)
}

type VideoSource

type VideoSource struct {
	// URL of the video source.
	URL string `json:"url"`
	// Type of the video source.
	Type VideoSourceType `json:"type"`
	// Quality of the video source.
	// e.g. "default", "auto", "1080p".
	Quality string `json:"quality"`
	// Subtitles for the video source.
	Subtitles []*VideoSubtitle `json:"subtitles"`
}

type VideoSourceType

type VideoSourceType string
const (
	VideoSourceMP4  VideoSourceType = "mp4"
	VideoSourceM3U8 VideoSourceType = "m3u8"
)

type VideoSubtitle

type VideoSubtitle struct {
	ID  string `json:"id"`
	URL string `json:"url"`
	// e.g. "en", "fr"
	Language  string `json:"language"`
	IsDefault bool   `json:"isDefault"`
}

Jump to

Keyboard shortcuts

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