Fix "upcoming" videos

This commit is contained in:
Brahim Hadriche committed 2023-10-25 20:51:36 -04:00
1 parent 584ee9a38a
commit dd79d85cca
2 files changed
+5 -3

No files matched your search

@@ -36,7 +36,6 @@ namespace InvidiousContent
SetIfExists(node, "author", item, "author")
SetIfExists(node, "authorId", item, "authorId")
SetIfExists(node, "hlsUrl", item, "hlsUrl")
SetIfExists(node, "isUpcoming", item, "isUpcoming")
SetIfExists(node, "lengthSeconds", item, "lengthSeconds")
node.lengthText = TimeUtils.GetFormattedTime(item.lengthSeconds)
node.liveNow = VideoIsLive(item)
@@ -159,11 +158,12 @@ namespace InvidiousContent
end function
function VideoIsUpcoming(videoItem as object) as boolean
return videoItem.isUpcoming = true
return videoItem.isUpcoming = true and ValidInt(videoItem.premiereTimestamp) <> 0
end function
function VideoSetPremiereTimestampText(node as object, videoItem as object)
if VideoIsUpcoming(videoItem) and videoItem.premiereTimestamp <> invalid
if VideoIsUpcoming(videoItem)
node.isUpcoming = true
node.premiereTimestampText = `Premeres in ${TimeUtils.GetFormattedTimeLeft(videoItem.premiereTimestamp)}`
end if
end function
+2
View File
@@ -54,6 +54,8 @@
searchForVideoById(videoInfo.videoId, videoInfo.timestamp);
return;
} else {
// TODO:P2 make a HEAD request and check for a redirect, then
// resolve the redirect url.
const urlInfo: any = await invidiousApi.resolveUrl(dataString);
if (urlInfo && urlInfo.pageType === "WEB_PAGE_TYPE_CHANNEL") {
searchForChannelById(urlInfo.ucid);