Improve performance of video bookmarks (#662)

* Improve performance of video bookmarks

* remove test code
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2025-06-20 11:53:41 -04:00
1 parent 63f8ba8617
commit d8417ee90c
8 files changed
+252 -28

No files matched your search

@@ -572,17 +572,38 @@ namespace Http
videoId = videoId.Left(videoId.InStr("?"))
end if
raw = request.query.raw <> invalid
videoInfoBatched = request.query.video_info_batched <> invalid
options = {
"raw": raw
"visitorData": m.innertube.visitorData
}
metadata = InnertubeService.GetVideoMetadata(videoId, options)
if videoInfoBatched
options["retry"] = false
metadata = InnertubeService.GetVideoInfoBatched([videoId], options)
if IsArray(metadata.videos) and metadata.videos.Count() > 0
metadata = metadata.videos[0]
else
metadata = {
"error": "Failed to get video info with video_info_batched=true"
}
end if
else
metadata = InnertubeService.GetVideoMetadata(videoId, options)
end if
response.Json(metadata)
if metadata.error <> invalid
response.http_code = 500
return true
end if
' If we're only interested in video info and not streaming data,
' we can return longer cache time.
if videoInfoBatched
response.headers["cache-control"] = "public, max-age=259200" ' 3 days
end if
return true