Various fixes and improvements
This commit is contained in:
1 parent
d77d00a4eb
commit
6e97cc5d9e
13 files changed
+134
-66
No files matched your search
+3
-1
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Nothing worth mentioning yet.
|
### Fixed
|
||||||
|
|
||||||
|
- Various fixes and improvements
|
||||||
|
|
||||||
## [0.41.5] - 2025-09-05
|
## [0.41.5] - 2025-09-05
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ class DashManifest
|
|||||||
|
|
||||||
xml = new XmlObject()
|
xml = new XmlObject()
|
||||||
|
|
||||||
|
xml.Comment(`Generated by Playlet - Video ID: ${metadata.videoId}`)
|
||||||
|
|
||||||
if xml.Node("MPD", {
|
if xml.Node("MPD", {
|
||||||
"xmlns": "urn:mpeg:dash:schema:mpd:2011"
|
"xmlns": "urn:mpeg:dash:schema:mpd:2011"
|
||||||
"profiles": "urn:mpeg:dash:profile:full:2011"
|
"profiles": "urn:mpeg:dash:profile:full:2011"
|
||||||
@@ -111,8 +113,16 @@ class DashManifest
|
|||||||
"value": `${stream.audioChannels}`
|
"value": `${stream.audioChannels}`
|
||||||
})
|
})
|
||||||
|
|
||||||
xml.TextNode("BaseURL", stream.url)
|
if stream.url = invalid
|
||||||
|
xml.Comment(`[ERROR] Stream.url is invalid for itag: ${stream.itag}`)
|
||||||
|
else stream.url.InStr("source=yt_live_broadcast")
|
||||||
|
xml.Comment(`[WARN] Stream URL indicates a live broadcast for itag: ${stream.itag}`)
|
||||||
|
end if
|
||||||
|
xml.TextNode("BaseURL", ValidString(stream.url))
|
||||||
|
|
||||||
|
if StringUtils.IsNullOrEmpty(stream.index) or StringUtils.IsNullOrEmpty(stream.init)
|
||||||
|
xml.Comment(`[ERROR] Stream index: ${stream.index}, init: ${stream.init} is invalid for itag: ${stream.itag}`)
|
||||||
|
end if
|
||||||
if xml.Node("SegmentBase", { "indexRange": stream.index })
|
if xml.Node("SegmentBase", { "indexRange": stream.index })
|
||||||
xml.EmptyNode("Initialization", { "range": stream.init })
|
xml.EmptyNode("Initialization", { "range": stream.init })
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace InnertubeService
|
|||||||
|
|
||||||
if fetchNext
|
if fetchNext
|
||||||
if nextResponse.IsSuccess()
|
if nextResponse.IsSuccess()
|
||||||
parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse)
|
parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse, nextResponse)
|
||||||
else
|
else
|
||||||
LogWarn(nextResponse.ErrorMessage())
|
LogWarn(nextResponse.ErrorMessage())
|
||||||
end if
|
end if
|
||||||
@@ -211,7 +211,9 @@ namespace InnertubeService
|
|||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
feeds = Innertube.ParseResponseDataForFeeds(responseData)
|
feeds = Innertube.ParseResponseDataForFeeds(responseData, {
|
||||||
|
response: response
|
||||||
|
})
|
||||||
|
|
||||||
if videoIds.Count() > 1
|
if videoIds.Count() > 1
|
||||||
if feeds.Count() > 0
|
if feeds.Count() > 0
|
||||||
@@ -283,6 +285,7 @@ namespace InnertubeService
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
|
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
|
||||||
|
response: response
|
||||||
disableCreatorOnTheRise: true
|
disableCreatorOnTheRise: true
|
||||||
disableShorts: disableShorts
|
disableShorts: disableShorts
|
||||||
})
|
})
|
||||||
@@ -334,7 +337,10 @@ namespace InnertubeService
|
|||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|
||||||
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { disableShorts: disableShorts })
|
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
|
||||||
|
response: response
|
||||||
|
disableShorts: disableShorts
|
||||||
|
})
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
feeds: feeds
|
feeds: feeds
|
||||||
@@ -494,7 +500,7 @@ namespace InnertubeService
|
|||||||
return response.Json()
|
return response.Json()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
result = Innertube.ParseChannelPageResponseData(response.Json())
|
result = Innertube.ParseChannelPageResponseData(response.Json(), response)
|
||||||
if result.authorId = invalid and result.error = invalid
|
if result.authorId = invalid and result.error = invalid
|
||||||
result["authorId"] = channelId
|
result["authorId"] = channelId
|
||||||
end if
|
end if
|
||||||
@@ -636,7 +642,7 @@ namespace InnertubeService
|
|||||||
return response.Json()
|
return response.Json()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
result = Innertube.ParsePlaylistPageResponseData(response.Json())
|
result = Innertube.ParsePlaylistPageResponseData(response.Json(), response)
|
||||||
|
|
||||||
if result.playlistId = invalid and result.error = invalid
|
if result.playlistId = invalid and result.error = invalid
|
||||||
result["playlistId"] = playlistId
|
result["playlistId"] = playlistId
|
||||||
@@ -677,7 +683,7 @@ namespace InnertubeService
|
|||||||
return response.Json()
|
return response.Json()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
result = Innertube.ParseMixPageResponseData(response.Json())
|
result = Innertube.ParseMixPageResponseData(response.Json(), response)
|
||||||
|
|
||||||
cacheControl = Innertube.ParseResponseForCacheControl(response)
|
cacheControl = Innertube.ParseResponseForCacheControl(response)
|
||||||
if cacheControl <> invalid
|
if cacheControl <> invalid
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Innertube
|
|||||||
})
|
})
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseInnertubeNextResponse(payload as object, parsedResponse as object) as object
|
function ParseInnertubeNextResponse(payload as object, parsedResponse as object, response as object) as object
|
||||||
if parsedResponse.error <> invalid
|
if parsedResponse.error <> invalid
|
||||||
LogWarn("Invalid parsed response", parsedResponse)
|
LogWarn("Invalid parsed response", parsedResponse)
|
||||||
return parsedResponse
|
return parsedResponse
|
||||||
@@ -72,7 +72,10 @@ namespace Innertube
|
|||||||
|
|
||||||
endscreen = playerOverlayRenderer["endScreen"]
|
endscreen = playerOverlayRenderer["endScreen"]
|
||||||
|
|
||||||
feeds = Innertube.ParseResponseDataForFeeds(endscreen, { noContainers: true })
|
feeds = Innertube.ParseResponseDataForFeeds(endscreen, {
|
||||||
|
response: response
|
||||||
|
noContainers: true
|
||||||
|
})
|
||||||
if feeds.Count() > 0
|
if feeds.Count() > 0
|
||||||
parsedResponse.recommendedVideos.Append(ValidArray(feeds[0].items))
|
parsedResponse.recommendedVideos.Append(ValidArray(feeds[0].items))
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Innertube
|
|||||||
for each key in nodeData
|
for each key in nodeData
|
||||||
directive = directives[key]
|
directive = directives[key]
|
||||||
if directive = invalid
|
if directive = invalid
|
||||||
Warning(`Unknown node ${key}`, nodeData[key])
|
Warning(`Unknown node ${key}`, nodeData[key], context)
|
||||||
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw "Unknown node: " + key
|
throw "Unknown node: " + key
|
||||||
@@ -144,6 +144,7 @@ namespace Innertube
|
|||||||
"supexOnboardingErrorCommand": ParseNotImplemented
|
"supexOnboardingErrorCommand": ParseNotImplemented
|
||||||
' Suicide & crisis lifeline, shown on sensitive content
|
' Suicide & crisis lifeline, shown on sensitive content
|
||||||
"emergencyOneboxRenderer": ParseNotImplemented
|
"emergencyOneboxRenderer": ParseNotImplemented
|
||||||
|
"backstagePostRenderer": ParseNotImplemented
|
||||||
"counterfactualRenderer": ParseNotImplemented
|
"counterfactualRenderer": ParseNotImplemented
|
||||||
"ticketShelfRenderer": ParseNotImplemented
|
"ticketShelfRenderer": ParseNotImplemented
|
||||||
"videoSurveyShelfRenderer": ParseNotImplemented
|
"videoSurveyShelfRenderer": ParseNotImplemented
|
||||||
@@ -170,7 +171,7 @@ namespace Innertube
|
|||||||
return nodeData["tabs"]
|
return nodeData["tabs"]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseTwoColumnWatchNextResults(nodeData as object, _context as object) as object
|
function ParseTwoColumnWatchNextResults(nodeData as object, context as object) as object
|
||||||
subItems = []
|
subItems = []
|
||||||
|
|
||||||
results = ObjectUtils.Dig(nodeData, ["results", "results", "contents"])
|
results = ObjectUtils.Dig(nodeData, ["results", "results", "contents"])
|
||||||
@@ -190,7 +191,7 @@ namespace Innertube
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if subItems.Count() = 0
|
if subItems.Count() = 0
|
||||||
Warning("No results found in twoColumnWatchNextResults", nodeData)
|
Warning("No results found in twoColumnWatchNextResults", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
return subItems
|
return subItems
|
||||||
@@ -327,7 +328,7 @@ namespace Innertube
|
|||||||
function ParseVideoRenderer(nodeData as object, context as object) as object
|
function ParseVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in videoRenderer", nodeData)
|
Warning("Invalid video ID in videoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -429,7 +430,7 @@ namespace Innertube
|
|||||||
function ParseGridVideoRenderer(nodeData as object, context as object) as object
|
function ParseGridVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in gridVideoRenderer", nodeData)
|
Warning("Invalid video ID in gridVideoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -514,7 +515,7 @@ namespace Innertube
|
|||||||
function ParseCompactVideoRenderer(nodeData as object, context as object) as object
|
function ParseCompactVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in compactVideoRenderer", nodeData)
|
Warning("Invalid video ID in compactVideoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -650,7 +651,7 @@ namespace Innertube
|
|||||||
function ParseChannelVideoPlayerRenderer(nodeData as object, context as object) as object
|
function ParseChannelVideoPlayerRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in channelVideoPlayerRenderer", nodeData)
|
Warning("Invalid video ID in channelVideoPlayerRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -679,7 +680,7 @@ namespace Innertube
|
|||||||
function ParsePlaylistVideoRenderer(nodeData as object, context as object) as object
|
function ParsePlaylistVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID playlistVideoRenderer", nodeData)
|
Warning("Invalid video ID playlistVideoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -728,7 +729,7 @@ namespace Innertube
|
|||||||
function ParsePlaylistPanelVideoRenderer(nodeData as object, context as object) as object
|
function ParsePlaylistPanelVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in playlistPanelVideoRenderer", nodeData)
|
Warning("Invalid video ID in playlistPanelVideoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -794,7 +795,7 @@ namespace Innertube
|
|||||||
function ParseEndScreenVideoRenderer(nodeData as object, context as object) as object
|
function ParseEndScreenVideoRenderer(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["videoId"]
|
videoId = nodeData["videoId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in endScreenVideoRenderer", nodeData)
|
Warning("Invalid video ID in endScreenVideoRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -826,7 +827,7 @@ namespace Innertube
|
|||||||
function ParseChannelRenderer(nodeData as object, context as object) as object
|
function ParseChannelRenderer(nodeData as object, context as object) as object
|
||||||
channelId = nodeData["channelId"]
|
channelId = nodeData["channelId"]
|
||||||
if not IsString(channelId)
|
if not IsString(channelId)
|
||||||
Warning("Invalid channel ID in channelRenderer", nodeData)
|
Warning("Invalid channel ID in channelRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -846,7 +847,7 @@ namespace Innertube
|
|||||||
function ParseGridChannelRenderer(nodeData as object, context as object) as object
|
function ParseGridChannelRenderer(nodeData as object, context as object) as object
|
||||||
channelId = nodeData["channelId"]
|
channelId = nodeData["channelId"]
|
||||||
if not IsString(channelId)
|
if not IsString(channelId)
|
||||||
Warning("Invalid channel ID gridChannelRenderer", nodeData)
|
Warning("Invalid channel ID gridChannelRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -866,7 +867,7 @@ namespace Innertube
|
|||||||
function ParsePlaylistRenderer(nodeData as object, context as object) as object
|
function ParsePlaylistRenderer(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["playlistId"]
|
playlistId = nodeData["playlistId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID in playlistRenderer", nodeData)
|
Warning("Invalid playlist ID in playlistRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -916,7 +917,7 @@ namespace Innertube
|
|||||||
function ParseGridPlaylistRenderer(nodeData as object, context as object) as object
|
function ParseGridPlaylistRenderer(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["playlistId"]
|
playlistId = nodeData["playlistId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID gridPlaylistRenderer", nodeData)
|
Warning("Invalid playlist ID gridPlaylistRenderer", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -992,7 +993,7 @@ namespace Innertube
|
|||||||
return LockupViewModelTypeAlbum(nodeData, context)
|
return LockupViewModelTypeAlbum(nodeData, context)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
Warning(`Unknown content type: ${contentType}`, nodeData)
|
Warning(`Unknown content type: ${contentType}`, nodeData, context)
|
||||||
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw "Unknown content type: " + contentType
|
throw "Unknown content type: " + contentType
|
||||||
@@ -1004,7 +1005,7 @@ namespace Innertube
|
|||||||
function LockupViewModelTypeVideo(nodeData as object, context as object) as object
|
function LockupViewModelTypeVideo(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["contentId"]
|
videoId = nodeData["contentId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in lockupViewModelTypeVideo", nodeData)
|
Warning("Invalid video ID in lockupViewModelTypeVideo", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1063,7 +1064,7 @@ namespace Innertube
|
|||||||
function LockupViewModelTypePlaylist(nodeData as object, context as object) as object
|
function LockupViewModelTypePlaylist(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["contentId"]
|
playlistId = nodeData["contentId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID in lockupViewModelTypePlaylist", nodeData)
|
Warning("Invalid playlist ID in lockupViewModelTypePlaylist", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1112,7 +1113,7 @@ namespace Innertube
|
|||||||
function LockupViewModelTypePodcast(nodeData as object, context as object) as object
|
function LockupViewModelTypePodcast(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["contentId"]
|
playlistId = nodeData["contentId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID in lockupViewModelTypePodcast", nodeData)
|
Warning("Invalid playlist ID in lockupViewModelTypePodcast", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1147,7 +1148,7 @@ namespace Innertube
|
|||||||
function LockupViewModelTypeAlbum(nodeData as object, context as object) as object
|
function LockupViewModelTypeAlbum(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["contentId"]
|
playlistId = nodeData["contentId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID in lockupViewModelTypeAlbum", nodeData)
|
Warning("Invalid playlist ID in lockupViewModelTypeAlbum", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1187,7 +1188,7 @@ namespace Innertube
|
|||||||
|
|
||||||
videoId = ObjectUtils.Dig(nodeData, ["onTap", "innertubeCommand", "reelWatchEndpoint", "videoId"])
|
videoId = ObjectUtils.Dig(nodeData, ["onTap", "innertubeCommand", "reelWatchEndpoint", "videoId"])
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in shortsLockupViewModel", nodeData)
|
Warning("Invalid video ID in shortsLockupViewModel", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1250,7 +1251,7 @@ namespace Innertube
|
|||||||
' A tileRenderer can be without a contentType, such as a
|
' A tileRenderer can be without a contentType, such as a
|
||||||
' button that says "Open YouTube Kids" or similar CTAs
|
' button that says "Open YouTube Kids" or similar CTAs
|
||||||
if contentType = ""
|
if contentType = ""
|
||||||
Warning("TileRenderer without contentType", nodeData)
|
Warning("TileRenderer without contentType", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1262,7 +1263,7 @@ namespace Innertube
|
|||||||
return TileRendererTypePlaylist(nodeData, context)
|
return TileRendererTypePlaylist(nodeData, context)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
Warning(`Unknown content type: ${contentType}`, nodeData)
|
Warning(`Unknown content type: ${contentType}`, nodeData, context)
|
||||||
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
#if DEBUG_THROW_ON_UNKNOWN_NODES
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
throw "Unknown content type: " + contentType
|
throw "Unknown content type: " + contentType
|
||||||
@@ -1274,7 +1275,7 @@ namespace Innertube
|
|||||||
function TileRendererTypeVideo(nodeData as object, context as object) as object
|
function TileRendererTypeVideo(nodeData as object, context as object) as object
|
||||||
videoId = nodeData["contentId"]
|
videoId = nodeData["contentId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in tileRendererTypeVideo", nodeData)
|
Warning("Invalid video ID in tileRendererTypeVideo", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1363,7 +1364,7 @@ namespace Innertube
|
|||||||
|
|
||||||
videoId = nodeData["contentId"]
|
videoId = nodeData["contentId"]
|
||||||
if not IsString(videoId)
|
if not IsString(videoId)
|
||||||
Warning("Invalid video ID in tileRendererTypeShorts", nodeData)
|
Warning("Invalid video ID in tileRendererTypeShorts", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1406,7 +1407,7 @@ namespace Innertube
|
|||||||
function TileRendererTypePlaylist(nodeData as object, context as object) as object
|
function TileRendererTypePlaylist(nodeData as object, context as object) as object
|
||||||
playlistId = nodeData["contentId"]
|
playlistId = nodeData["contentId"]
|
||||||
if not IsString(playlistId)
|
if not IsString(playlistId)
|
||||||
Warning("Invalid playlist ID in tileRendererTypePlaylist", nodeData)
|
Warning("Invalid playlist ID in tileRendererTypePlaylist", nodeData, context)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -1734,7 +1735,7 @@ namespace Innertube
|
|||||||
]
|
]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function Warning(message as string, nodeData as object) as void
|
function Warning(message as string, nodeData as object, context as object) as void
|
||||||
nodeDataString = FormatJson(nodeData)
|
nodeDataString = FormatJson(nodeData)
|
||||||
|
|
||||||
LogWarnNoTelemetry(message + `\n` + nodeDataString)
|
LogWarnNoTelemetry(message + `\n` + nodeDataString)
|
||||||
@@ -1747,6 +1748,10 @@ namespace Innertube
|
|||||||
filename: "node_data.json"
|
filename: "node_data.json"
|
||||||
content_type: "application/json"
|
content_type: "application/json"
|
||||||
data: nodeDataString
|
data: nodeDataString
|
||||||
|
}, {
|
||||||
|
filename: "request.txt"
|
||||||
|
content_type: "text/plain"
|
||||||
|
data: context.response.request.ToCurlCommand()
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -5,13 +5,11 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
|
|
||||||
namespace Innertube
|
namespace Innertube
|
||||||
|
|
||||||
function ParseResponseDataForFeeds(responseData as object, context = invalid as object) as object
|
function ParseResponseDataForFeeds(responseData as object, context as object) as object
|
||||||
if responseData = invalid
|
if responseData = invalid
|
||||||
return []
|
return []
|
||||||
end if
|
end if
|
||||||
|
|
||||||
context = ValidAssociativeArray(context)
|
|
||||||
|
|
||||||
if not ValidBool(context.noContainers)
|
if not ValidBool(context.noContainers)
|
||||||
containers = GetContainers(responseData)
|
containers = GetContainers(responseData)
|
||||||
if containers.Count() = 0
|
if containers.Count() = 0
|
||||||
@@ -41,7 +39,7 @@ namespace Innertube
|
|||||||
return context.feeds
|
return context.feeds
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseChannelPageResponseData(responseData as object) as object
|
function ParseChannelPageResponseData(responseData as object, response as object) as object
|
||||||
if responseData = invalid
|
if responseData = invalid
|
||||||
return {
|
return {
|
||||||
error: "Invalid response data"
|
error: "Invalid response data"
|
||||||
@@ -142,7 +140,11 @@ namespace Innertube
|
|||||||
items = []
|
items = []
|
||||||
continuation = invalid
|
continuation = invalid
|
||||||
sortOptions = invalid
|
sortOptions = invalid
|
||||||
feeds = ParseResponseDataForFeeds(responseData, { "currentAuthor": author, "currentAuthorId": authorId })
|
feeds = ParseResponseDataForFeeds(responseData, {
|
||||||
|
response: response
|
||||||
|
"currentAuthor": author
|
||||||
|
"currentAuthorId": authorId
|
||||||
|
})
|
||||||
if feeds.Count() > 0
|
if feeds.Count() > 0
|
||||||
items = ValidArray(feeds[0].items)
|
items = ValidArray(feeds[0].items)
|
||||||
if feeds[0].DoesExist("continuation")
|
if feeds[0].DoesExist("continuation")
|
||||||
@@ -176,7 +178,7 @@ namespace Innertube
|
|||||||
return channel
|
return channel
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParsePlaylistPageResponseData(responseData as object) as object
|
function ParsePlaylistPageResponseData(responseData as object, response as object) as object
|
||||||
if responseData = invalid
|
if responseData = invalid
|
||||||
return {
|
return {
|
||||||
error: "Invalid response data"
|
error: "Invalid response data"
|
||||||
@@ -270,7 +272,9 @@ namespace Innertube
|
|||||||
playlist["statsText"] = statsText
|
playlist["statsText"] = statsText
|
||||||
end if
|
end if
|
||||||
|
|
||||||
feeds = ParseResponseDataForFeeds(responseData)
|
feeds = ParseResponseDataForFeeds(responseData, {
|
||||||
|
response: response
|
||||||
|
})
|
||||||
if feeds.Count() > 0
|
if feeds.Count() > 0
|
||||||
playlist["videos"] = ValidArray(feeds[0].items)
|
playlist["videos"] = ValidArray(feeds[0].items)
|
||||||
if feeds[0].DoesExist("continuation")
|
if feeds[0].DoesExist("continuation")
|
||||||
@@ -285,7 +289,7 @@ namespace Innertube
|
|||||||
return playlist
|
return playlist
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseMixPageResponseData(responseData as object) as object
|
function ParseMixPageResponseData(responseData as object, response as object) as object
|
||||||
if responseData = invalid
|
if responseData = invalid
|
||||||
return {
|
return {
|
||||||
error: "Invalid response data"
|
error: "Invalid response data"
|
||||||
@@ -330,7 +334,9 @@ namespace Innertube
|
|||||||
"videoCountText": ""
|
"videoCountText": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
feeds = ParseResponseDataForFeeds(playlist)
|
feeds = ParseResponseDataForFeeds(playlist, {
|
||||||
|
response: invalid
|
||||||
|
})
|
||||||
if feeds.Count() > 0
|
if feeds.Count() > 0
|
||||||
result["videos"] = ValidArray(feeds[0].items)
|
result["videos"] = ValidArray(feeds[0].items)
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -333,21 +333,21 @@ namespace Innertube
|
|||||||
result["index"] = ""
|
result["index"] = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if IsString(fmt["audioQuality"])
|
if fmt["audioQuality"] <> invalid
|
||||||
result["audioQuality"] = fmt["audioQuality"]
|
result["audioQuality"] = ToString(fmt["audioQuality"])
|
||||||
end if
|
end if
|
||||||
if IsString(fmt["audioSampleRate"])
|
if fmt["audioSampleRate"] <> invalid
|
||||||
result["audioSampleRate"] = fmt["audioSampleRate"]
|
result["audioSampleRate"] = ToString(fmt["audioSampleRate"])
|
||||||
end if
|
end if
|
||||||
if IsString(fmt["audioChannels"])
|
if fmt["audioChannels"] <> invalid
|
||||||
result["audioChannels"] = fmt["audioChannels"]
|
result["audioChannels"] = ToString(fmt["audioChannels"])
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if IsString(fmt["qualityLabel"])
|
if IsString(fmt["qualityLabel"])
|
||||||
result["qualityLabel"] = fmt["qualityLabel"]
|
result["qualityLabel"] = fmt["qualityLabel"]
|
||||||
end if
|
end if
|
||||||
if IsString(fmt["fps"])
|
if fmt["fps"] <> invalid
|
||||||
result["fps"] = fmt["fps"]
|
result["fps"] = ToString(fmt["fps"])
|
||||||
end if
|
end if
|
||||||
|
|
||||||
result["width"] = fmt["width"]
|
result["width"] = fmt["width"]
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ namespace Innertube
|
|||||||
return response.Json()
|
return response.Json()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
feeds = ParseResponseDataForFeeds(response.Json(), { disableShorts: disableShorts })
|
feeds = ParseResponseDataForFeeds(response.Json(), {
|
||||||
|
response: response
|
||||||
|
disableShorts: disableShorts
|
||||||
|
})
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
feeds: feeds
|
feeds: feeds
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ function ReportVideoError(errorData as object) as void
|
|||||||
if not StringUtils.IsNullOrEmpty(lastGeneratedDash)
|
if not StringUtils.IsNullOrEmpty(lastGeneratedDash)
|
||||||
attachments = [{
|
attachments = [{
|
||||||
filename: "last_generated_dash.xml"
|
filename: "last_generated_dash.xml"
|
||||||
content_type: "application/dash+xml"
|
content_type: "plain/text"
|
||||||
data: lastGeneratedDash
|
data: lastGeneratedDash
|
||||||
}]
|
}]
|
||||||
DeleteFile("tmp:/last_generated_dash.xml")
|
DeleteFile("tmp:/last_generated_dash.xml")
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Http
|
|||||||
else
|
else
|
||||||
m.setState(Http.HttpConnectionState.DONE)
|
m.setState(Http.HttpConnectionState.DONE)
|
||||||
m.close = true
|
m.close = true
|
||||||
LogError("couldn't process request or response, closing @" + m.client)
|
LogErrorNoTelemetry("couldn't process request or response, closing @" + m.client)
|
||||||
end if
|
end if
|
||||||
else if m.request.buffer.len() > m.settings.MaxRequestLength ' die if it's too long
|
else if m.request.buffer.len() > m.settings.MaxRequestLength ' die if it's too long
|
||||||
m.response = new HttpResponse(m.request, m.server, m.settings)
|
m.response = new HttpResponse(m.request, m.server, m.settings)
|
||||||
|
|||||||
@@ -99,7 +99,10 @@ namespace Http
|
|||||||
operation = m.ReadHeaderLine()
|
operation = m.ReadHeaderLine()
|
||||||
|
|
||||||
if operation = invalid or operation = ""
|
if operation = invalid or operation = ""
|
||||||
LogError("empty request")
|
LogError("empty request", FormatJson({
|
||||||
|
"m.buffer": m.buffer
|
||||||
|
"m.buffer_index": m.buffer_index
|
||||||
|
}))
|
||||||
m.ready_for_response = true
|
m.ready_for_response = true
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
|
|
||||||
class XmlObject
|
class XmlObject
|
||||||
private stack = []
|
private stack = []
|
||||||
|
|
||||||
private root = invalid
|
private root = invalid
|
||||||
|
private prolog = []
|
||||||
private INDENT_SIZE = 2
|
private INDENT_SIZE = 2
|
||||||
|
|
||||||
function Node(name as string, attributes = invalid as object) as boolean
|
function Node(name as string, attributes = invalid as object) as boolean
|
||||||
newNode = {
|
newNode = {
|
||||||
|
type: "node"
|
||||||
name: name
|
name: name
|
||||||
attributes: attributes
|
attributes: attributes
|
||||||
children: []
|
children: []
|
||||||
@@ -28,7 +28,10 @@ class XmlObject
|
|||||||
|
|
||||||
function Text(text as string)
|
function Text(text as string)
|
||||||
if m.stack.count() > 0
|
if m.stack.count() > 0
|
||||||
m.stack[m.stack.count() - 1].children.push(text)
|
m.stack[m.stack.count() - 1].children.push({
|
||||||
|
type: "text"
|
||||||
|
text: text
|
||||||
|
})
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -47,8 +50,29 @@ class XmlObject
|
|||||||
m.stack.pop()
|
m.stack.pop()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function Comment(comment as string)
|
||||||
|
if m.stack.count() > 0
|
||||||
|
m.stack[m.stack.count() - 1].children.push({
|
||||||
|
type: "comment"
|
||||||
|
comment: comment
|
||||||
|
})
|
||||||
|
else
|
||||||
|
m.prolog.push({
|
||||||
|
type: "comment"
|
||||||
|
comment: comment
|
||||||
|
})
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
function ToXmlString() as string
|
function ToXmlString() as string
|
||||||
return `<?xml version="1.0" encoding="UTF-8"?>\n` + m.NodeToXmlString(m.root, 0)
|
xml = `<?xml version="1.0" encoding="UTF-8"?>\n`
|
||||||
|
for each item in m.prolog
|
||||||
|
if item.type = "comment"
|
||||||
|
xml += `<!-- ${item.comment} -->\n`
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
xml += m.NodeToXmlString(m.root, 0)
|
||||||
|
return xml
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function NodeToXmlString(node as object, indentLevel as integer) as string
|
function NodeToXmlString(node as object, indentLevel as integer) as string
|
||||||
@@ -69,21 +93,23 @@ class XmlObject
|
|||||||
|
|
||||||
for i = 0 to node.children.count() - 1
|
for i = 0 to node.children.count() - 1
|
||||||
child = node.children[i]
|
child = node.children[i]
|
||||||
childIsString = IsString(child)
|
|
||||||
if i = 0
|
if i = 0
|
||||||
if not childIsString
|
if child.type <> "text"
|
||||||
xmlString += `\n`
|
xmlString += `\n`
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if childIsString
|
if child.type = "text"
|
||||||
xmlString += m.XmlEscape(child)
|
xmlString += m.XmlEscape(child.text)
|
||||||
|
else if child.type = "comment"
|
||||||
|
commentIndentString = string((indentLevel + 1) * m.INDENT_SIZE, " ")
|
||||||
|
xmlString += `${commentIndentString}<!-- ${child.comment} -->\n`
|
||||||
else
|
else
|
||||||
xmlString += m.NodeToXmlString(child, indentLevel + 1)
|
xmlString += m.NodeToXmlString(child, indentLevel + 1)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if i = node.children.count() - 1
|
if i = node.children.count() - 1
|
||||||
if not childIsString
|
if child.type <> "text"
|
||||||
xmlString += `${indentString}`
|
xmlString += `${indentString}`
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ namespace Tests
|
|||||||
@it("creates valid XML")
|
@it("creates valid XML")
|
||||||
function _()
|
function _()
|
||||||
xml = new XmlObject()
|
xml = new XmlObject()
|
||||||
|
xml.Comment("This is a person.")
|
||||||
if xml.Node("Person", { "name": `John "Joker" Doe`, "age": 30 })
|
if xml.Node("Person", { "name": `John "Joker" Doe`, "age": 30 })
|
||||||
|
xml.Comment("This is the address.")
|
||||||
xml.EmptyNode("Address", { "street": "123 Main St", "city": "Anytown", "state": "NY" })
|
xml.EmptyNode("Address", { "street": "123 Main St", "city": "Anytown", "state": "NY" })
|
||||||
if xml.Node("Metadata")
|
if xml.Node("Metadata")
|
||||||
xml.TextNode("Data", "Some data")
|
xml.TextNode("Data", "Some data")
|
||||||
@@ -18,7 +20,9 @@ namespace Tests
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
expected = `<?xml version="1.0" encoding="UTF-8"?>
|
expected = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- This is a person. -->
|
||||||
<Person age="30" name="John "Joker" Doe">
|
<Person age="30" name="John "Joker" Doe">
|
||||||
|
<!-- This is the address. -->
|
||||||
<Address city="Anytown" state="NY" street="123 Main St" />
|
<Address city="Anytown" state="NY" street="123 Main St" />
|
||||||
<Metadata>
|
<Metadata>
|
||||||
<Data>Some data</Data>
|
<Data>Some data</Data>
|
||||||
|
|||||||
Reference in new issue
Block a user