sdarot

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 16 Imported by: 0

README

Sdarot

GoDoc

Wrapper for sdarot.tv .

Installation

go get github.com/yakiroren/sdarot

Example Usage

client, _ := sdarot.New(sdarot.Config{
    Username: "user",
    Password: "Password1",
})

// Get episode
video, _ := client.GetVideo(sdarot.VideoRequest{
    SeriesID: 19,
    Season:   1,
    Episode:  1,
})

// save video to file
file, _ := os.Create(fmt.Sprintf("%d.mp4", video.ID))

client.Download(video, file)

Documentation

Index

Constants

View Source
const SdarotURL = "https://sdarot.tw"

Variables

View Source
var (
	ErrServerOverLoad = errors.New("servers overload")
	ErrUnexpected     = errors.New("unexpected error")
)
View Source
var ErrInvalidCredentials = fmt.Errorf("InvalidCredentials")

Functions

This section is empty.

Types

type Client

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

func New

func New(config Config) (*Client, error)

New create a Client.

func (*Client) Download

func (client *Client) Download(video *Video, writer io.Writer) error

Download the given video and write it into the given writer.

func (*Client) DownloadWithContext

func (client *Client) DownloadWithContext(ctx context.Context, video *Video, writer io.Writer) error

DownloadWithContext the given video and write it into the given writer.

func (*Client) GetSeriesByID added in v1.0.0

func (client *Client) GetSeriesByID(id int) (*Series, error)

func (*Client) GetSeriesWithContext added in v1.0.0

func (client *Client) GetSeriesWithContext(ctx context.Context, seriesID int) (*Series, error)

func (*Client) GetVideo

func (client *Client) GetVideo(data VideoRequest) (*Video, error)

GetVideo fetches the requested episode from Sdarot and returns a Video object. Note: there is a 30-second delay internally.

func (*Client) GetVideoWithContext

func (client *Client) GetVideoWithContext(ctx context.Context, data VideoRequest) (*Video, error)

GetVideoWithContext fetches the requested episode from Sdarot and returns a Video object. Note: there is a 30-second delay internally.

func (*Client) Search

func (client *Client) Search(term string) ([]*Series, error)

Search returns an array of SearchResult for a given term.

func (*Client) SearchWithContext

func (client *Client) SearchWithContext(ctx context.Context, term string) ([]*Series, error)

SearchWithContext returns an array of SearchResult for a given term.

type Config

type Config struct {
	Username string
	Password string
	IsMember bool
}

type SearchResult

type SearchResult struct {
	SeriesID    string
	HebrewName  string
	EnglishName string
}

type Series added in v1.0.0

type Series struct {
	ID          int
	HebrewName  string
	EnglishName string
	Seasons     [][]VideoRequest
}

func (*Series) BuildVideoRequest added in v1.0.0

func (s *Series) BuildVideoRequest(season int, episode int) VideoRequest

func (*Series) GetEpisodes added in v1.0.0

func (s *Series) GetEpisodes(season int) []VideoRequest

func (*Series) GetSeasons added in v1.0.0

func (s *Series) GetSeasons() int

type Video

type Video struct {
	ID       int
	URL      url.URL
	Metadata VideoRequest
	Size     int64
}

type VideoRequest

type VideoRequest struct {
	SeriesID int
	Season   int
	Episode  int
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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