Skip to content

Commit

Permalink
include adaptive formats
Browse files Browse the repository at this point in the history
  • Loading branch information
cybre committed Jan 25, 2022
1 parent fd97b7a commit 4a0c7d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 45 deletions.
50 changes: 6 additions & 44 deletions response_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,51 +90,13 @@ type Format struct {
AudioSampleRate string `json:"audioSampleRate"`
AudioChannels int `json:"audioChannels"`
}
type InitRange struct {
Start string `json:"start"`
End string `json:"end"`
}
type IndexRange struct {
Start string `json:"start"`
End string `json:"end"`
}
type ColorInfo struct {
Primaries string `json:"primaries"`
TransferCharacteristics string `json:"transferCharacteristics"`
MatrixCoefficients string `json:"matrixCoefficients"`
}
type AdaptiveFormats struct {
Itag int `json:"itag"`
URL string `json:"url"`
MimeType string `json:"mimeType"`
Bitrate int `json:"bitrate"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
InitRange InitRange `json:"initRange,omitempty"`
IndexRange IndexRange `json:"indexRange,omitempty"`
LastModified string `json:"lastModified"`
ContentLength string `json:"contentLength,omitempty"`
Quality string `json:"quality"`
FPS int `json:"fps,omitempty"`
QualityLabel string `json:"qualityLabel,omitempty"`
ProjectionType string `json:"projectionType"`
TargetDurationSec int `json:"targetDurationSec"`
MaxDvrDurationSec int `json:"maxDvrDurationSec"`
AverageBitrate int `json:"averageBitrate,omitempty"`
ApproxDurationMs string `json:"approxDurationMs,omitempty"`
ColorInfo ColorInfo `json:"colorInfo,omitempty"`
HighReplication bool `json:"highReplication,omitempty"`
AudioQuality string `json:"audioQuality,omitempty"`
AudioSampleRate string `json:"audioSampleRate,omitempty"`
AudioChannels int `json:"audioChannels,omitempty"`
}
type StreamingData struct {
ExpiresInSeconds string `json:"expiresInSeconds"`
Formats []Format `json:"formats"`
AdaptiveFormats []AdaptiveFormats `json:"adaptiveFormats"`
OnesieStreamingURL string `json:"onesieStreamingUrl"`
DashManifestURL string `json:"dashManifestUrl"`
HlsManifestURL string `json:"hlsManifestUrl"`
ExpiresInSeconds string `json:"expiresInSeconds"`
Formats []Format `json:"formats"`
AdaptiveFormats []Format `json:"adaptiveFormats"`
OnesieStreamingURL string `json:"onesieStreamingUrl"`
DashManifestURL string `json:"dashManifestUrl"`
HlsManifestURL string `json:"hlsManifestUrl"`
}
type HeartbeatParams struct {
IntervalMilliseconds string `json:"intervalMilliseconds"`
Expand Down
2 changes: 1 addition & 1 deletion video.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (v *Video) extractDataFromPlayerResponse(prData playerResponseData) error {
// }

// Assign Streams
v.Formats = append(prData.StreamingData.Formats, prData.StreamingData.Formats...)
v.Formats = append(prData.StreamingData.Formats, prData.StreamingData.AdaptiveFormats...)
if len(v.Formats) == 0 {
return errors.New("no formats found in the server's answer")
}
Expand Down

0 comments on commit 4a0c7d6

Please sign in to comment.