vrvgo

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: GPL-3.0 Imports: 20 Imported by: 0

README

vrvgo

A Go library for downloading VRV episodes, series, and seasons

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMSLink struct {
	// The CMS link used internally to callCMS
	Link string `json:"href"`
}

A struct for the CMS links in each response type

type CollectionResult

type CollectionResult struct {
	Items []struct {
		Links struct {
			// A CMS link for season information
			SeasonCMS CMSLink `json:"episode/season"`

			// A CMS link for series information
			SeriesCMS CMSLink `json:"episode/series"`

			// A CMS link for individual video information
			SelfCMS CMSLink `json:"resource"`

			// A CMS link for uploader information
			ChannelCMS CMSLink `json:"resource/channel"`

			// A CMS link for stream information
			StreamsCMS CMSLink `json:"streams"`
		} `json:"__links__"`
	} `json:"items"`
}

A CollectionResult represents the object that is returned when an initial search for an episode, series, or season is done

type Episode

type Episode struct {
	// The custom HTTP Client used for Episode requests
	Client *HTTPClient

	// The class of the JSON response (should be episode)
	Class string `json:"__class__"`

	// The unqiue ID of the episode
	ID string `json:"id"`

	// The channel ID of the video uploader
	ChannelID string `json:"channel_id"`

	// The title of the series the episode is a part of
	SeriesTitle string `json:"series_title"`

	// The season number
	SeasonNumber int `json:"season_number"`

	// The episode number in the season
	Number float64 `json:"episode_number"`

	// The title of the episode
	Title string `json:"title"`

	// The description of the episode
	Description string `json:"description"`

	// Is the episode intended for mature audiences
	IsMature bool `json:"is_mature"`

	// Is the mature content blocked on the user's account
	IsMatureBlocked bool `json:"mature_blocked"`

	// When the episode aired (2012-10-29T09:35:00-07:00) format
	EpisodeAirDate string `json:"episode_air_date"`

	// Does the series have subtitles
	IsSubbed bool `json:"is_subbed"`

	// Is the series episode dubbed
	IsDubbed bool `json:"is_dubbed"`

	// Duration of the episode (milliseconds)
	Duration int `json:"duration_ms"`

	// Is the episode only avaliable for premium members
	IsPremiumOnly bool `json:"is_premium_only"`

	// Is the episode avaliable offline
	IsAvaliableOffline bool `json:"available_offline"`

	//IsHD bool `json:"hd_flag"`
	Links struct {
		// A CMS link for uploader information
		ChannelCMS CMSLink `json:"episode/channel"`

		// A CMS link for movie information
		Movies CMSLink `json:"movie_listing/movies"`

		// A CMS link for season information
		SeasonCMS CMSLink `json:"episode/season"`

		// A CMS link for series information
		SeriesCMS CMSLink `json:"episode/series"`

		// A CMS link for stream information
		Streams CMSLink `json:"streams"`
	} `json:"__links__`

	Images struct {
		// A list of thumbnails for the epside
		Thumbnails [][]Thumbnail `json:"thumbnail"`
	} `json:"images`
}

A VRV Episode

func (*Episode) Download

func (e *Episode) Download(dir, subLang, quality string) (err error)

Downloads a single episode

func (*Episode) GetSeason

func (e *Episode) GetSeason() (season *Season, err error)

Returns the season that the episode is a part of

func (*Episode) GetSeries

func (e *Episode) GetSeries() (series *Series, err error)

Returns the series that the episode is a part of

type Episodes

type Episodes struct {
	// The number of episodes in the list
	EpisodeCount int `json:"total"`

	// The list of episodes
	Episodes []Episode `json"items"`
}

type HTTPClient

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

Custom HTTP client that handles all requests made by the VRV Struct

func (*HTTPClient) DoOAuthRequest

func (h *HTTPClient) DoOAuthRequest(method, url string, body io.Reader) (*http.Response, error)

Calls DoRequest with OAuth Token information retrieved from login

func (*HTTPClient) DoRequest

func (h *HTTPClient) DoRequest(method, url string, body io.Reader) (*http.Response, error)

Calls the custsom HTTP Client with the provided arguments

type OAuthClientResp

type OAuthClientResp struct {
	Params struct {
		// The authentication key returned on VRV's website
		OAuthKey string `json:"oAuthKey"`

		// The authentication secret returned on VRV's website
		OAuthSecret string `json:"oAuthSecret"`

		// The API URL that VRV uses to make API requests
		ApiDomain string `json:"apiDomain"`
	} `json:"cxApiParams"`
}

type OAuthToken

type OAuthToken struct {
	OAuthToken        string `json:"oauth_token"`
	OAuthTokenSecret  string `json:"oauth_token_secret"`
	OAuthClientKey    string `json:"oauth_client_key"`
	OAuthClientSecret string `json:"oAuthSecret"`
	AccountID         string `json:"account_id"`
	ApiDomain         string `json:"apiDomain"`
}

type Season

type Season struct {
	// The custom HTTP Client used for the Season
	Client *HTTPClient

	// The class of the JSON response (should be season)
	Class string `json:"__class__"`

	// The unqiue ID of the season
	ID string `json:"id"`

	// The title of the season
	Title string `json:"title"`

	// The description of the season
	Description string `json:"description"`

	// The season number
	Number int `json:"season_number"`

	//idk if this is supposed to be whether the account
	// has completed it or whether it's done being made
	IsComplete bool `json:"is_complete"`

	// Is the season intended for mature audiences
	IsMature bool `json:"is_mature"`

	// Is mature content blocked on the current user's account
	IsMatureBlocked bool `json:"mature_blocked"`

	// Does the season have subtitles
	IsSubbed bool `json:"is_subbed"`

	// Is the season dubbed
	IsDubbed bool `json:"is_dubbed"`

	// Is the season simulcasted
	IsSimulcast bool `json:"is_simulcast"`

	// The seasonal tags for the season
	Tags []string `json:"season_tags"`

	Links struct {
		// A CMS link for uploader information
		ChannelCMS CMSLink `json:"season/channel"`

		// A CMS link for episodes information
		EpisodesCMS CMSLink `json:"season/episodes"`

		// A CMS link for series information
		SeriesCMS CMSLink `json:"season/series"`
	} `json:"__links__`
}

A VRV Season

func (*Season) Download

func (s *Season) Download(dir, subLang, quality string) error

Downloads all episodes in a season

func (*Season) GetEpisodes

func (s *Season) GetEpisodes() (episodes *Episodes, err error)

Gets the episodes of a season

func (*Season) GetSeries

func (s *Season) GetSeries() (series *Series, err error)

Gets the series a season is a part of

type Seasons

type Seasons struct {
	// The class of the JSON response (should be collection)
	Class string `json:"__class__"`

	// Number of seasons
	Count int `json:"total"`

	// An array of the seasons
	Seasons []Season `json:"items"`
}

A VRV Season Container

type Series

type Series struct {

	// The custom HTTP Client for the series
	Client *HTTPClient

	// The unique ID of the series
	ID string `json:"id"`

	// What website/channel uploaded the series
	Uploader string `json:"channel_id"`

	// Title of the Series
	Title string `json:"title"`

	// Description of the series
	Description string `json:"description"`

	// Tags for the series for using VRV's search feature
	Tags string `json:"keywords"`

	// Seasonal tags for the series
	SeasonTags string `json:"season_tags"`

	// String tags of the rating on the series (ex "TV-14")
	MatureRatings []string `json:"maturity_ratings"`

	// Number of episodes in the series
	EpisodeCount int `json:"episode_count"`

	// Number of seasons in the series
	SeasonCount int `json:"season_count"`

	// Is the series itended for mature audiences
	IsMature bool `json:"is_mature"`

	// Are mature videos blocked for the account logged in
	IsMatureBlocked bool `json:"mature_blocked"`

	// Does the series have subtitles
	IsSubbed bool `json:"is_subbed"`

	// Is the series dubbed
	IsDubbed bool `json:"is_dubbed"`

	// Is the series simulcasted
	IsSimulcast bool `json:"is_simulcast"`

	Links struct {
		// A CMS link for uploader information
		ChannelCMS CMSLink `json:"series/channel"`

		// A CMS link for season information
		SeasonsCMS CMSLink `json:"series/seasons"`
	} `json:"__links__`
}

A VRV Series

func (*Series) Download

func (s *Series) Download(dir, subLang, quality string) error

Downloads all episodes in a series

func (*Series) GetSeasons

func (s *Series) GetSeasons() (seasons *Seasons, err error)

Returns all seasons that are a part of a series

type StreamHolder

type StreamHolder struct {
	// The hard-coded language for the stream ("", "en-US", "ja-JP", etc...)
	Hardsub string `json:"hardsub_locale"`

	// The URL to the stream download
	URL string `json:"url"`
}

type Streams

type Streams struct {
	// The type of the struct (stream)
	Class string `json:"__class__"`

	// Subtitles for the streams
	Subtitles []Subtitle `json:"subtitles"`

	// The audio language of the streams
	AudioLanguage string `json:"audio_locale"`

	// The media ID of the streams
	ID string `json:"media_id"`

	Streams struct {
		HLS []StreamHolder `json:"adaptive_hls"`
	} `json:"streams"`
}

A VRV stream list

type Subtitle

type Subtitle struct {
	// The language of the subtitle
	Language string `json:"locale"`

	// The URL to the subtitle download
	URL string `json:"url"`

	// The format the subtitle uses (typically .ass)
	Format string `json:"format"`
}

A VRV subtitle

type Thumbnail

type Thumbnail struct {
	// The width of the thumbnail
	Width int `json:"width"`

	// The height of the thumbnail
	Height int `json:"height"`

	// The URL path to the thumbnail
	URL string `json:"type"`

	// The type of theumbnail
	Type string `json:"source"`
}

type VRVClient

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

Main client for downloading videos

func NewVRVClient

func NewVRVClient(client *http.Client) VRVClient

func (*VRVClient) Authenticate

func (v *VRVClient) Authenticate(email, password string) error

func (*VRVClient) GetEpisode

func (v *VRVClient) GetEpisode(url string) (*Episode, error)

func (*VRVClient) GetSeries

func (v *VRVClient) GetSeries(url string) (*Series, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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