onlinestream

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 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 {
	// Provider is the ID of the provider.
	// This should be the same as the extension ID and follow the same format.
	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 {
	// Provider is the ID of the provider.
	// This should be the same as the extension ID and follow the same format.
	Provider string `json:"provider"`
	// Server is the video server name.
	// e.g. "vidcloud".
	Server string `json:"server"`
	// Headers are the 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(query string, dub bool) ([]*SearchResult, error)
	// FindEpisode returns the episode details for the given anime ID.
	// The ID is the anime slug.
	FindEpisode(id string) ([]*EpisodeDetails, error)
	// FindEpisodeServer returns the episode server for the given episode.
	// "server" can be "default"
	FindEpisodeServer(episode *EpisodeDetails, server string) (*EpisodeServer, error)
	// GetEpisodeServers returns the list of servers from the provider.
	GetEpisodeServers() []string
}

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 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"
	VideoSourceDash VideoSourceType = "dash"
)

type VideoSubtitle

type VideoSubtitle struct {
	ID        string `json:"id"`
	URL       string `json:"url"`
	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