Backend can return raw response

This commit is contained in:
Brahim Hadriche committed 2025-01-17 16:28:16 -05:00
1 parent 951a13be1f
commit 975980a3b5
3 files changed
+131 -16

No files matched your search

@@ -18,6 +18,7 @@ namespace InnertubeService
cancellation = invalid
fetchNext = true
ctt = ""
raw = false
if options <> invalid
if options.DoesExist("cancellation")
@@ -29,6 +30,9 @@ namespace InnertubeService
if options.DoesExist("ctt")
ctt = options.ctt
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
playerRequest = Innertube.CreatePlayerRequest(videoId, ctt)
@@ -60,6 +64,16 @@ namespace InnertubeService
nextResponse = nextRequest.Await()
end if
if raw
rawResponse = {
"playerResponse": playerResponse.Json()
}
if fetchNext
rawResponse["nextResponse"] = nextResponse.Json()
end if
return rawResponse
end if
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json())
if parsedResponse.error <> invalid
return parsedResponse
@@ -158,6 +172,7 @@ namespace InnertubeService
searchFilters = invalid
continuation = ""
cancellation = invalid
raw = false
if options <> invalid
if options.DoesExist("searchFilters")
@@ -169,14 +184,18 @@ namespace InnertubeService
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
return Innertube.Search(query, searchFilters, continuation, cancellation)
return Innertube.Search(query, searchFilters, continuation, cancellation, raw)
end function
function GetTrending(options = invalid as object) as object
cancellation = invalid
params = ""
raw = false
if options <> invalid
if options.DoesExist("cancellation")
@@ -193,6 +212,9 @@ namespace InnertubeService
params = "4gIKGgh0cmFpbGVycw%3D%3D"
end if
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
request = Innertube.CreateBrowseRequest("FEtrending", Innertube.ClientType.WEB, params)
@@ -203,8 +225,11 @@ namespace InnertubeService
return invalid
end if
json = response.Json()
feeds = Innertube.ParseResponseDataForFeeds(json, { skipCreatorOnTheRise: true })
if raw
return response.Json()
end if
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { skipCreatorOnTheRise: true })
result = {
feeds: feeds
@@ -270,6 +295,7 @@ namespace InnertubeService
continuation = ""
params = ""
cancellation = invalid
raw = false
if options <> invalid
if options.DoesExist("continuation")
@@ -281,6 +307,9 @@ namespace InnertubeService
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
request = Innertube.CreateBrowseRequest(channelId, Innertube.ClientType.Web, params, continuation)
@@ -293,8 +322,11 @@ namespace InnertubeService
}
end if
json = response.Json()
result = Innertube.ParseChannelPageResponseData(json)
if raw
return response.Json()
end if
result = Innertube.ParseChannelPageResponseData(response.Json())
if result.authorId = invalid and result.error = invalid
result["authorId"] = channelId
end if
@@ -310,6 +342,7 @@ namespace InnertubeService
function GetPlaylist(playlistId as string, options = invalid as object) as object
continuation = ""
cancellation = invalid
raw = false
if options <> invalid
if options.DoesExist("continuation")
@@ -318,6 +351,9 @@ namespace InnertubeService
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
if not playlistId.StartsWith("VL")
@@ -334,8 +370,11 @@ namespace InnertubeService
}
end if
json = response.Json()
result = Innertube.ParsePlaylistPageResponseData(json)
if raw
return response.Json()
end if
result = Innertube.ParsePlaylistPageResponseData(response.Json())
cacheControl = Innertube.ParseResponseForCacheControl(response)
if cacheControl <> invalid
@@ -348,6 +387,7 @@ namespace InnertubeService
function GetMix(mixId as string, options = invalid as object) as object
videoId = ""
cancellation = invalid
raw = false
if options <> invalid
if options.DoesExist("videoId")
@@ -356,6 +396,9 @@ namespace InnertubeService
if options.DoesExist("cancellation")
cancellation = options.cancellation
end if
if options.DoesExist("raw")
raw = options.raw
end if
end if
args = { "playlistId": mixId }
@@ -372,8 +415,11 @@ namespace InnertubeService
}
end if
json = response.Json()
return Innertube.ParseMixPageResponseData(json)
if raw
return response.Json()
end if
return Innertube.ParseMixPageResponseData(response.Json())
end function
function ResolveUrl(url as string, options = invalid as object) as object