utils

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ACTOR = "actor"

ACTOR a metadata constant for actor entry

View Source
const CONTENTID = "contentId"

CONTENTID a metadata constant for content id entry

View Source
const GENRE = "genre"

GENRE a metadata constant for genre entry

Variables

This section is empty.

Functions

func CopyMap

func CopyMap(m map[string]string) map[string]string

CopyMap creates a copy of given map of string.

func DownloadAudioOrVideo

func DownloadAudioOrVideo(videoURL string, videoID string, vFormat string, userFfmpegPath string, outputFileName string, metadataFlag bool, isDashAV bool)

DownloadAudioOrVideo downloads the video for given video format and video url. It also adds metadata to it if needed. FFMPEG path and Output video file name can be customized.

func DownloadDashFilesBatch

func DownloadDashFilesBatch(currentDirectoryPath, videoID string, vFormatCode string, format map[string]string, requestHeaders map[string]string) ([]string, string)

DownloadDashFilesBatch downloads the dash chunks for the given video format

func Generate

func Generate(start int64) string

Generate generates Hotstar authorization code for given time.

func GenerateHotstarAuth

func GenerateHotstarAuth() string

GenerateHotstarAuth generates Hotstar authorization code.

func GetDashFormats

func GetDashFormats(data []byte, masterPlaybackURL string) map[string]map[string]map[string]string

GetDashFormats gives the dash formats for any given dash URL

func GetDateStr

func GetDateStr(timeFloat64 float64) string

GetDateStr parses given time in milliseconds to human readable Date string.

func GetMasterPlaybackURLs

func GetMasterPlaybackURLs(playbackURIPageContents []byte) ([]string, error)

GetMasterPlaybackURLs gets master playback urls from playback uri page contents.

func GetParsedVideoURL

func GetParsedVideoURL(videoURL string) string

GetParsedVideoURL parses given video url for proper url scheme.

func GetPlaybackURI

func GetPlaybackURI(videoURLPageContents string, videoURL string, videoID string, uuid string) (string, map[string]string, error)

GetPlaybackURI gets the playback uri from the metadata in the given page contents.

func GetPlaybackURI2

func GetPlaybackURI2(videoID string, uuid string) string

GetPlaybackURI2 gets the playback uri v2 from videoID

func GetPlaybackURI3

func GetPlaybackURI3(videoID string, uuid string) string

GetPlaybackURI3 gets the playback uri v2 from videoID

func GetVideoFormats

func GetVideoFormats(videoURL string, videoID string, meta map[string]string) (map[string]map[string]string, map[string]string, error)

GetVideoFormats gets all available video formats for given video url.

func IsValidHotstarURL

func IsValidHotstarURL(videoOrPlaylistURL string) (bool, string, bool)

IsValidHotstarURL validates if the given video url is a valid Hotstar url or not.

func ListOrDownloadPlaylistVideoFormats

func ListOrDownloadPlaylistVideoFormats(playlistID string, titleFlag bool, descriptionFlag bool, playlistStartRange string, playlistEndRange string, isDownloadSwitch bool, vFormat string, userFfmpegPath string, outputFileName string, metadataFlag bool, isDashAV bool)

ListOrDownloadPlaylistVideoFormats lists video formats (or) title (or) description of each video url in the list.

func ListVideoFormats

func ListVideoFormats(videoURL string, videoID string, metadata map[string]string, titleFlag bool, descriptionFlag bool)

ListVideoFormats lists video formats (or) title (or) description of the video for given video url.

func MakeGetRequest

func MakeGetRequest(url string, headers map[string]string) ([]byte, error)

MakeGetRequest makes GET request for given url with given headers and returns web page contents as bytes with errors if any.

func MakeRange

func MakeRange(min, max int) []int

MakeRange generates a range of numbers for the given range

func ParseM3u8Content

func ParseM3u8Content(m3u8Content string, playbackURL string, playbackURLData string) map[string]map[string]string

ParseM3u8Content parses given m3u8Content content and returns map of map of string containing video format list.

func PopulateMetaDataMapWithMetadata

func PopulateMetaDataMapWithMetadata(metaDataMap map[string]string, metadata map[string]interface{})

PopulateMetaDataMapWithMetadata poulates metadata map with required meta-data

func ReSubMatchMap

func ReSubMatchMap(r *regexp.Regexp, str string) map[string]string

ReSubMatchMap returns the regex submatches as a map

Types

type AdaptationSet

type AdaptationSet struct {
	MaxHeight        string           `xml:"maxHeight,attr"`
	MaxWidth         string           `xml:"maxWidth,attr"`
	MimeType         string           `xml:"mimeType,attr"`
	SegmentAlignment string           `xml:"segmentAlignment,attr"`
	StartWithSAP     string           `xml:"startWithSAP,attr"`
	SegTemplate      SegmentTemplate  `xml:"SegmentTemplate"`
	Representations  []Representation `xml:"Representation"`
}

AdaptationSet struct contains

type AudioChannelConfiguration

type AudioChannelConfiguration struct {
	SchemeIDURI string `xml:"schemeIdUri,attr"`
	Value       string `xml:"value,attr"`
}

AudioChannelConfiguration struct contains config of channel

type MPD

type MPD struct {
	MediaPresentationDuration string          `xml:"mediaPresentationDuration,attr"`
	MinBufferTime             string          `xml:"minBufferTime,attr"`
	Profiles                  string          `xml:"profiles,attr"`
	Xmlns                     string          `xml:"xmlns,attr"`
	Period                    []AdaptationSet `xml:"Period>AdaptationSet"`
}

MPD struct contains

type Representation

type Representation struct {
	Bandwidth                 string `xml:"bandwidth,attr"`
	Codecs                    string `xml:"codecs,attr"`
	FrameRate                 string `xml:"frameRate,attr"`
	Height                    string `xml:"height,attr"`
	ID                        string `xml:"id,attr"`
	ScanType                  string `xml:"scanType,attr"`
	Width                     string `xml:"width,attr"`
	AudioSamplingRate         string `xml:"audioSamplingRate,attr"`
	AudioChannelConfiguration string `xml:"AudioChannelConfiguration"`
}

Representation struct contains

type SegmentTemplate

type SegmentTemplate struct {
	Duration       string `xml:"duration,attr"`
	Initialization string `xml:"initialization,attr"`
	Media          string `xml:"media,attr"`
	StartNumber    string `xml:"startNumber,attr"`
	Timescale      string `xml:"timescale,attr"`
}

SegmentTemplate struct contains info about segments

Jump to

Keyboard shortcuts

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