Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c034dfe109 | ||
|
|
129f0a8adb | ||
|
|
a42c7221c6 | ||
|
|
c602fe3ed2 | ||
|
|
33bb74d976 | ||
|
|
422c867c00 | ||
|
|
6e43528802 | ||
|
|
61d4baa181 | ||
|
|
7f451af418 | ||
|
|
b72a1522a4 | ||
|
|
86b1afe243 | ||
|
|
67bf473dda |
No files matched your search
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.43.8] - 2025-11-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix in url decipher logic
|
||||||
|
- Redo OTF segment processing
|
||||||
|
|
||||||
|
## [0.43.7] - 2025-11-06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Adjust telemetry for OTF streams to debug
|
||||||
|
|
||||||
|
## [0.43.6] - 2025-11-06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Bug in processing OTF streams info
|
||||||
|
|
||||||
## [0.43.5] - 2025-11-06
|
## [0.43.5] - 2025-11-06
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.38",
|
"@rokucommunity/bslint": "^0.8.38",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.38",
|
"@rokucommunity/bslint": "^0.8.38",
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.43.5"
|
"version": "0.43.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title=Playlet
|
|||||||
# Do not update version manually, it is auto updated from package.json
|
# Do not update version manually, it is auto updated from package.json
|
||||||
major_version=0
|
major_version=0
|
||||||
minor_version=43
|
minor_version=43
|
||||||
build_version=00005
|
build_version=00008
|
||||||
|
|
||||||
ui_resolutions=hd
|
ui_resolutions=hd
|
||||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.43.5"
|
"version": "0.43.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"description": "Unofficial YouTube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
||||||
|
|||||||
@@ -496,11 +496,7 @@ class DashManifest
|
|||||||
xml.Comment(`[ERROR] OTF stream has empty otfSegmentDurations for itag: ${stream.itag}`)
|
xml.Comment(`[ERROR] OTF stream has empty otfSegmentDurations for itag: ${stream.itag}`)
|
||||||
end if
|
end if
|
||||||
for each segment in segmentDurations
|
for each segment in segmentDurations
|
||||||
sAttributes = { "d": segment.duration }
|
xml.EmptyNode("S", segment)
|
||||||
if segment.repeatCount <> invalid
|
|
||||||
sAttributes["r"] = segment.repeatCount
|
|
||||||
end if
|
|
||||||
xml.EmptyNode("S", sAttributes)
|
|
||||||
end for
|
end for
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
import "pkg:/components/Services/Innertube/Context.bs"
|
||||||
|
|
||||||
|
namespace Innertube
|
||||||
|
|
||||||
|
' OTF (On-The-Fly?) segment info retrieval and parsing
|
||||||
|
' When innertube returns adaptive formats, sometimes there's a property
|
||||||
|
' attached to the object: adaptiveFormats[].type = "FORMAT_STREAM_TYPE_OTF".
|
||||||
|
' When that happens, the segment info (durations, repeat counts) is not included
|
||||||
|
' in the response. Instead, they are appended to the media init segment itself.
|
||||||
|
' The init segment would contain video init information, which is binary, appended
|
||||||
|
' with a text section in this format:
|
||||||
|
' `Segment-Count: 731\r\n` +
|
||||||
|
' `Segment-Durations-Ms: 5333,5334,5333(r=1),5334,5333(r=1),\r\n`
|
||||||
|
' Because of this, the init segment needs to be downloaded to a tmp file, loaded in
|
||||||
|
' a byte array, converted to hex, and parsed. Loading the file to ascii string directly
|
||||||
|
' would not work because it would be truncated at the first null byte.
|
||||||
|
|
||||||
|
const OTF_MAX_REQUEST_COUNT = 8
|
||||||
|
|
||||||
|
function OTFGetSegmentInfo(adaptiveFormats as object, client as Innertube.ClientType, cancellation as object) as void
|
||||||
|
errors = {
|
||||||
|
message: ""
|
||||||
|
attachments: []
|
||||||
|
}
|
||||||
|
|
||||||
|
formatsToProcess = []
|
||||||
|
for i = 0 to adaptiveFormats.Count() - 1
|
||||||
|
formatsToProcess.Push({
|
||||||
|
format: adaptiveFormats[i]
|
||||||
|
file: `tmp:/otf_segments/${i}.bin`
|
||||||
|
})
|
||||||
|
end for
|
||||||
|
|
||||||
|
pendingFormats = []
|
||||||
|
|
||||||
|
requestHeaders = Innertube.CreateHeaders(client)
|
||||||
|
requestHeaders["origin"] = "https://www.youtube.com"
|
||||||
|
requestHeaders["referer"] = "https://www.youtube.com"
|
||||||
|
requestHeaders["DNT"] = "?1"
|
||||||
|
|
||||||
|
fs = CreateObject("roFileSystem")
|
||||||
|
fs.Delete("tmp:/otf_segments")
|
||||||
|
fs.CreateDirectory("tmp:/otf_segments")
|
||||||
|
|
||||||
|
while true
|
||||||
|
while formatsToProcess.Count() > 0 and pendingFormats.Count() < OTF_MAX_REQUEST_COUNT
|
||||||
|
formatToProcess = formatsToProcess.Pop()
|
||||||
|
request = OTFMakeSegmentInfoRequest(formatToProcess.format, formatToProcess.file, requestHeaders, errors, cancellation)
|
||||||
|
if request <> invalid
|
||||||
|
formatToProcess.request = request
|
||||||
|
pendingFormats.Push(formatToProcess)
|
||||||
|
end if
|
||||||
|
end while
|
||||||
|
|
||||||
|
if pendingFormats.Count() = 0
|
||||||
|
exit while
|
||||||
|
end if
|
||||||
|
|
||||||
|
pendingFormat = pendingFormats.Shift()
|
||||||
|
' returns false if processing should stop (e.g., cancelled)
|
||||||
|
if not OTFProcessPendingFormat(pendingFormat.format, pendingFormat.request, pendingFormat.file, errors)
|
||||||
|
exit while
|
||||||
|
end if
|
||||||
|
end while
|
||||||
|
|
||||||
|
fs.Delete("tmp:/otf_segments")
|
||||||
|
|
||||||
|
if not StringUtils.IsNullOrEmpty(errors.message) or errors.attachments.Count() > 0
|
||||||
|
LogTelemetryEvent({
|
||||||
|
level: "error"
|
||||||
|
message: `OTF errors during segment info retrieval: \n${errors.message}`
|
||||||
|
fingerprint: ["OTF errors during segment info retrieval"]
|
||||||
|
attachments: errors.attachments
|
||||||
|
})
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OTFMakeSegmentInfoRequest(format as object, file as string, requestHeaders as object, errors as object, cancellation as object) as object
|
||||||
|
url = format.url
|
||||||
|
if StringUtils.IsNullOrEmpty(url)
|
||||||
|
errors.message += `URL is empty for itag ${format.itag}.\n`
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
queryComponents = UrlUtils.ParseQueryComponents(url)
|
||||||
|
queryComponents["rn"] = "0"
|
||||||
|
queryComponents["sq"] = "0"
|
||||||
|
otfUrl = UrlUtils.SetQueryParams(url, queryComponents)
|
||||||
|
|
||||||
|
request = HttpClient.Get(otfUrl)
|
||||||
|
request.Headers(requestHeaders)
|
||||||
|
request.ToFile(file)
|
||||||
|
request.Cancellation(cancellation)
|
||||||
|
request.Send()
|
||||||
|
|
||||||
|
return request
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OTFProcessPendingFormat(format as object, request as object, file as string, errors as object) as boolean
|
||||||
|
response = request.Await()
|
||||||
|
|
||||||
|
if response.IsCancelled()
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
|
||||||
|
if not response.IsSuccess()
|
||||||
|
errors.message += `Failed to get segment info for itag ${format.itag}: ${response.ErrorMessage()}\n`
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
segmentDurations = OTFParseFileForSegmentInfo(file, errors)
|
||||||
|
if segmentDurations = invalid
|
||||||
|
errors.message += `Failed to parse segment info for itag ${format.itag}.\n`
|
||||||
|
errors.message += `Headers: ${ToString(response.Headers())}\n`
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
format.otfSegmentInfo = segmentDurations
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OTFParseFileForSegmentInfo(filePath as string, errors as object) as dynamic
|
||||||
|
buffer = CreateObject("roByteArray")
|
||||||
|
|
||||||
|
buffer.FromAsciiString("Segment-Durations-Ms:")
|
||||||
|
startMarkerHex = buffer.ToHexString()
|
||||||
|
|
||||||
|
buffer.FromAsciiString(`\r\n`)
|
||||||
|
endMarkerHex = buffer.ToHexString()
|
||||||
|
|
||||||
|
if not buffer.ReadFile(filePath)
|
||||||
|
errors.message += `Failed to read file at path ${filePath}.\n`
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
contentHex = buffer.ToHexString()
|
||||||
|
|
||||||
|
startIndex = contentHex.InStr(startMarkerHex)
|
||||||
|
if startIndex = -1
|
||||||
|
errors.message += `Start marker not found in file at path ${filePath}.\n`
|
||||||
|
errors.attachments.Push({
|
||||||
|
filename: filePath
|
||||||
|
content_type: "plain/text"
|
||||||
|
data: contentHex
|
||||||
|
})
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
endIndex = contentHex.InStr(startIndex, endMarkerHex)
|
||||||
|
if endIndex = -1
|
||||||
|
errors.message += `End marker not found in file at path ${filePath}.\n`
|
||||||
|
errors.attachments.Push({
|
||||||
|
filename: filePath
|
||||||
|
content_type: "plain/text"
|
||||||
|
data: contentHex
|
||||||
|
})
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
segmentDurationsMsHex = contentHex.Mid(startIndex + startMarkerHex.len(), endIndex - (startIndex + startMarkerHex.len()))
|
||||||
|
buffer.FromHexString(segmentDurationsMsHex)
|
||||||
|
segmentDurationsMs = buffer.ToAsciiString()
|
||||||
|
|
||||||
|
regex = CreateObject("roRegex", "(\d+)(?:\(r=(\d+)\))?", "g")
|
||||||
|
matches = regex.MatchAll(segmentDurationsMs)
|
||||||
|
if not IsArray(matches) or matches.Count() = 0
|
||||||
|
errors.message += `No segment duration matches found in file at path ${filePath}.\n`
|
||||||
|
errors.attachments.Push({
|
||||||
|
filename: filePath
|
||||||
|
content_type: "plain/text"
|
||||||
|
data: contentHex
|
||||||
|
})
|
||||||
|
return invalid
|
||||||
|
end if
|
||||||
|
|
||||||
|
segmentDurations = CreateObject("roArray", matches.Count(), false)
|
||||||
|
|
||||||
|
for i = 0 to matches.Count() - 1
|
||||||
|
match = matches[i]
|
||||||
|
segment = {}
|
||||||
|
' We set duration and repeatCount to "d" and "r" so that we can feed
|
||||||
|
' them directly into the DashManifest generation code.
|
||||||
|
if match.Count() >= 2
|
||||||
|
segment["d"] = match[1].ToInt()
|
||||||
|
end if
|
||||||
|
if match.Count() >= 3
|
||||||
|
segment["r"] = match[2].ToInt()
|
||||||
|
end if
|
||||||
|
segmentDurations[i] = segment
|
||||||
|
end for
|
||||||
|
|
||||||
|
return segmentDurations
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import "pkg:/components/Services/Innertube/Context.bs"
|
import "pkg:/components/Services/Innertube/Context.bs"
|
||||||
import "pkg:/components/Services/Innertube/NodesParser.bs"
|
import "pkg:/components/Services/Innertube/NodesParser.bs"
|
||||||
|
import "pkg:/components/Services/Innertube/OTFSegmentInfo.bs"
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
import "pkg:/source/utils/ObjectUtils.bs"
|
import "pkg:/source/utils/ObjectUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -168,7 +169,7 @@ namespace Innertube
|
|||||||
|
|
||||||
if isOTF
|
if isOTF
|
||||||
LogDebug("Fetching OTF segment info")
|
LogDebug("Fetching OTF segment info")
|
||||||
GetOTFSegmentInfo(adaptiveFormats, client, cancellation)
|
OTFGetSegmentInfo(adaptiveFormats, client, cancellation)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
return parsedResponse
|
return parsedResponse
|
||||||
@@ -547,8 +548,7 @@ namespace Innertube
|
|||||||
for i = 0 to decipheredFormats.Count() - 1
|
for i = 0 to decipheredFormats.Count() - 1
|
||||||
fmt = formats[i]
|
fmt = formats[i]
|
||||||
decipheredFmt = decipheredFormats[i]
|
decipheredFmt = decipheredFormats[i]
|
||||||
|
fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"])
|
||||||
fmt["url"] = decipheredFmt["url"]
|
|
||||||
end for
|
end for
|
||||||
|
|
||||||
decipheredAdaptiveFormats = json["adaptiveFormats"]
|
decipheredAdaptiveFormats = json["adaptiveFormats"]
|
||||||
@@ -562,11 +562,34 @@ namespace Innertube
|
|||||||
for i = 0 to decipheredAdaptiveFormats.Count() - 1
|
for i = 0 to decipheredAdaptiveFormats.Count() - 1
|
||||||
fmt = adaptiveFormats[i]
|
fmt = adaptiveFormats[i]
|
||||||
decipheredFmt = decipheredAdaptiveFormats[i]
|
decipheredFmt = decipheredAdaptiveFormats[i]
|
||||||
fmt["url"] = decipheredFmt["url"]
|
fmt["url"] = ResetUrlClientVersion(decipheredFmt["url"])
|
||||||
end for
|
end for
|
||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
' YouTube.js sets cver to hardcoded values that might be different from
|
||||||
|
' What's used in Playlet. There's no indication that this makes a difference,
|
||||||
|
' but it makes sense to keep it consistent.
|
||||||
|
function ResetUrlClientVersion(url as dynamic) as dynamic
|
||||||
|
if StringUtils.IsNullOrEmpty(url)
|
||||||
|
return url
|
||||||
|
end if
|
||||||
|
|
||||||
|
queryComponents = UrlUtils.ParseQueryComponents(url)
|
||||||
|
client = ValidString(queryComponents["c"])
|
||||||
|
if client = "TVHTML5"
|
||||||
|
queryComponents["cver"] = INNERTUBE_TV_CLIENT_VERSION
|
||||||
|
else if client = "IOS"
|
||||||
|
queryComponents["cver"] = INNERTUBE_IOS_CLIENT_VERSION
|
||||||
|
else if client = "WEB"
|
||||||
|
queryComponents["cver"] = INNERTUBE_WEB_CLIENT_VERSION
|
||||||
|
else
|
||||||
|
return url
|
||||||
|
end if
|
||||||
|
|
||||||
|
return UrlUtils.SetQueryParams(url, queryComponents)
|
||||||
|
end function
|
||||||
|
|
||||||
function ParseIsLoggedIn(payload as object) as boolean
|
function ParseIsLoggedIn(payload as object) as boolean
|
||||||
trackingParams = ObjectUtils.Dig(payload, ["responseContext", "serviceTrackingParams"])
|
trackingParams = ObjectUtils.Dig(payload, ["responseContext", "serviceTrackingParams"])
|
||||||
if not IsArray(trackingParams)
|
if not IsArray(trackingParams)
|
||||||
@@ -677,7 +700,12 @@ namespace Innertube
|
|||||||
url = UrlUtils.SetQueryParams(url, queryComponents)
|
url = UrlUtils.SetQueryParams(url, queryComponents)
|
||||||
|
|
||||||
request = HttpClient.Head(url)
|
request = HttpClient.Head(url)
|
||||||
request.Headers(Innertube.CreateHeaders(client))
|
requestHeaders = Innertube.CreateHeaders(client)
|
||||||
|
requestHeaders["origin"] = "https://www.youtube.com"
|
||||||
|
requestHeaders["referer"] = "https://www.youtube.com"
|
||||||
|
requestHeaders["DNT"] = "?1"
|
||||||
|
request.Headers(requestHeaders)
|
||||||
|
|
||||||
request.TryCount(2)
|
request.TryCount(2)
|
||||||
request.Cancellation(cancellation)
|
request.Cancellation(cancellation)
|
||||||
response = request.Await()
|
response = request.Await()
|
||||||
@@ -689,6 +717,10 @@ namespace Innertube
|
|||||||
|
|
||||||
headers = response.Headers()
|
headers = response.Headers()
|
||||||
|
|
||||||
|
if not headers.DoesExist("X-Head-Time-Millis") or not headers.DoesExist("X-Head-Seqnum")
|
||||||
|
LogError("GetPostLiveDvrInfo: Missing Post-Live DVR info in headers", headers)
|
||||||
|
end if
|
||||||
|
|
||||||
durationMs = ValidString(headers["X-Head-Time-Millis"]).ToInt()
|
durationMs = ValidString(headers["X-Head-Time-Millis"]).ToInt()
|
||||||
segmentCount = ValidString(headers["X-Head-Seqnum"]).ToInt()
|
segmentCount = ValidString(headers["X-Head-Seqnum"]).ToInt()
|
||||||
|
|
||||||
@@ -698,120 +730,6 @@ namespace Innertube
|
|||||||
if segmentCount > 0
|
if segmentCount > 0
|
||||||
parsedResponse["postLiveDvrSegmentCount"] = segmentCount
|
parsedResponse["postLiveDvrSegmentCount"] = segmentCount
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if segmentCount = 0 or durationMs = 0
|
|
||||||
LogError("GetPostLiveDvrInfo: Missing Post-Live DVR info in headers", headers)
|
|
||||||
end if
|
|
||||||
end function
|
|
||||||
|
|
||||||
function GetOTFSegmentInfo(adaptiveFormats as object, client as Innertube.ClientType, cancellation as object) as void
|
|
||||||
requests = CreateObject("roArray", adaptiveFormats.Count(), false)
|
|
||||||
|
|
||||||
requestHeaders = Innertube.CreateHeaders(client)
|
|
||||||
for i = 0 to adaptiveFormats.Count() - 1
|
|
||||||
format = adaptiveFormats[i]
|
|
||||||
if format.isTypeOTF <> true
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
url = format.url
|
|
||||||
if StringUtils.IsNullOrEmpty(url)
|
|
||||||
LogError("GetOTFSegmentInfo: URL is empty for itag", format.itag)
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
queryComponents = UrlUtils.ParseQueryComponents(url)
|
|
||||||
queryComponents["rn"] = "0"
|
|
||||||
queryComponents["sq"] = "0"
|
|
||||||
|
|
||||||
otfUrl = UrlUtils.SetQueryParams(url, queryComponents)
|
|
||||||
|
|
||||||
request = HttpClient.Get(otfUrl)
|
|
||||||
request.Headers(requestHeaders)
|
|
||||||
request.TryCount(2)
|
|
||||||
request.Cancellation(cancellation)
|
|
||||||
request.Send()
|
|
||||||
requests[`${i}`] = request
|
|
||||||
end for
|
|
||||||
|
|
||||||
for i = 0 to requests.Count() - 1
|
|
||||||
request = requests[`${i}`]
|
|
||||||
if request = invalid
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
format = adaptiveFormats[i]
|
|
||||||
response = request.Await()
|
|
||||||
|
|
||||||
if response.IsCancelled()
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
if not response.IsSuccess()
|
|
||||||
LogError("Failed to fetch OTF segment info for itag", format.itag, response.ErrorMessage())
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
responseText = response.Text()
|
|
||||||
|
|
||||||
segmentDurationsMs = StringUtils.GetBetween(responseText, "Segment-Durations-Ms:", `\r\n`)
|
|
||||||
if StringUtils.IsNullOrEmpty(segmentDurationsMs)
|
|
||||||
LogError("Failed to extract Segment-Durations-Ms from OTF stream for itag", format.itag)
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
segmentDurationStrings = segmentDurationsMs.Split(",")
|
|
||||||
segmentDurations = []
|
|
||||||
for each segmentDurationString in segmentDurationStrings
|
|
||||||
trimmedSegmentDuration = segmentDurationString.Trim()
|
|
||||||
if trimmedSegmentDuration.Len() = 0
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
repeatCount = invalid
|
|
||||||
repeatCountString = StringUtils.GetBetween(trimmedSegmentDuration, "(r=", ")")
|
|
||||||
if not StringUtils.IsNullOrEmpty(repeatCountString)
|
|
||||||
repeatCount = repeatCountString.ToInt()
|
|
||||||
end if
|
|
||||||
|
|
||||||
duration = trimmedSegmentDuration.ToInt()
|
|
||||||
if duration <= 0
|
|
||||||
LogErrorNoTelemetry("Invalid OTF segment duration parsed", trimmedSegmentDuration, "for itag", format.itag)
|
|
||||||
LogTelemetryEvent({
|
|
||||||
level: "error"
|
|
||||||
message: `Invalid OTF segment duration parsed: ${trimmedSegmentDuration} for itag ${format.itag}`
|
|
||||||
fingerprint: ["OTF Invalid Segment Duration"]
|
|
||||||
attachments: [{
|
|
||||||
filename: "otf.txt"
|
|
||||||
content_type: "plain/text"
|
|
||||||
data: responseText
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
continue for
|
|
||||||
end if
|
|
||||||
|
|
||||||
segmentDurations.Push({
|
|
||||||
duration: duration
|
|
||||||
repeatCount: repeatCount
|
|
||||||
})
|
|
||||||
end for
|
|
||||||
|
|
||||||
format["otfSegmentDurations"] = segmentDurations
|
|
||||||
|
|
||||||
if segmentDurations.Count() = 0
|
|
||||||
LogErrorNoTelemetry("No OTF segment durations found for itag", format.itag)
|
|
||||||
LogTelemetryEvent({
|
|
||||||
level: "error"
|
|
||||||
message: `No OTF segment durations found for itag ${format.itag}`
|
|
||||||
fingerprint: ["OTF No Segment Durations"]
|
|
||||||
attachments: [{
|
|
||||||
filename: "otf.txt"
|
|
||||||
content_type: "plain/text"
|
|
||||||
data: responseText
|
|
||||||
}]
|
|
||||||
})
|
|
||||||
end if
|
|
||||||
end for
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
@@ -56,7 +56,7 @@ namespace Http
|
|||||||
xmlContent = m.dashManifest.FromVideoMetadata(metadata, qualityFilter, ValidString(local) = "true")
|
xmlContent = m.dashManifest.FromVideoMetadata(metadata, qualityFilter, ValidString(local) = "true")
|
||||||
|
|
||||||
if xmlContent.InStr("[ERROR]") <> -1
|
if xmlContent.InStr("[ERROR]") <> -1
|
||||||
LogError("Dash manifest generated with errors")
|
LogErrorNoTelemetry("Dash manifest generated with errors")
|
||||||
lastPlayerResponse = ValidString(ReadAsciiFile("cachefs:/last_player_response.json"))
|
lastPlayerResponse = ValidString(ReadAsciiFile("cachefs:/last_player_response.json"))
|
||||||
LogTelemetryEvent({
|
LogTelemetryEvent({
|
||||||
level: "error"
|
level: "error"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title=PlayletLib
|
|||||||
# Do not update version manually, it is auto updated from package.json
|
# Do not update version manually, it is auto updated from package.json
|
||||||
major_version=0
|
major_version=0
|
||||||
minor_version=43
|
minor_version=43
|
||||||
build_version=00005
|
build_version=00008
|
||||||
|
|
||||||
ui_resolutions=hd
|
ui_resolutions=hd
|
||||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||||
|
|||||||
@@ -299,6 +299,11 @@ namespace HttpClient
|
|||||||
return m
|
return m
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function ToFile(filePath as string) as HttpRequest
|
||||||
|
m._toFilePath = filePath
|
||||||
|
return m
|
||||||
|
end function
|
||||||
|
|
||||||
function ToCurlCommand() as string
|
function ToCurlCommand() as string
|
||||||
command = `curl "${m.BuildUrl()}"`
|
command = `curl "${m.BuildUrl()}"`
|
||||||
if m._method = "HEAD"
|
if m._method = "HEAD"
|
||||||
@@ -387,6 +392,10 @@ namespace HttpClient
|
|||||||
end if
|
end if
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
|
if m._toFilePath <> invalid and m._method <> "GET"
|
||||||
|
throw "ToFile() can only be used with GET requests."
|
||||||
|
end if
|
||||||
|
|
||||||
if m._method = "POST"
|
if m._method = "POST"
|
||||||
body = m._body
|
body = m._body
|
||||||
if body = invalid
|
if body = invalid
|
||||||
@@ -394,7 +403,11 @@ namespace HttpClient
|
|||||||
end if
|
end if
|
||||||
m._sent = m.urlTransfer.AsyncPostFromString(body)
|
m._sent = m.urlTransfer.AsyncPostFromString(body)
|
||||||
else if m._method = "GET"
|
else if m._method = "GET"
|
||||||
|
if m._toFilePath <> invalid
|
||||||
|
m._sent = m.urlTransfer.AsyncGetToFile(m._toFilePath)
|
||||||
|
else
|
||||||
m._sent = m.urlTransfer.AsyncGetToString()
|
m._sent = m.urlTransfer.AsyncGetToString()
|
||||||
|
end if
|
||||||
else if m._method = "HEAD"
|
else if m._method = "HEAD"
|
||||||
m._sent = m.urlTransfer.AsyncHead()
|
m._sent = m.urlTransfer.AsyncHead()
|
||||||
else
|
else
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
||||||
"@tailwindcss/postcss": "^4.1.16",
|
"@tailwindcss/postcss": "^4.1.16",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-web",
|
"name": "playlet-web",
|
||||||
"version": "0.43.5",
|
"version": "0.43.8",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
Reference in new issue
Block a user