Compare commits

..
10 Commits
Author SHA1 Message Date
Brahim Hadriche 7e11a056f9 [skip ci] Update RELEASING.md 2025-06-21 07:20:00 -04:00
Brahim Hadriche 08c16a9830 [skip ci] fix warning 2025-06-21 07:18:39 -04:00
Brahim Hadriche aaef0352cb Release v0.40.6 (#664) 2025-06-21 07:15:06 -04:00
Brahim Hadriche 5ea6e11345 Announcement 2025-06-21 07:05:55 -04:00
Brahim Hadriche 141c80c618 [chore] update dependencies (#663)
* update dependencies

* update image rasterizer
2025-06-21 06:10:05 -04:00
Brahim Hadriche 5e26deea77 [skip ci] parser tweak 2025-06-20 20:28:12 -04:00
Brahim Hadriche 5884021e72 Experiment: isInlinePlaybackNoAd 2025-06-20 15:32:10 -04:00
Brahim Hadriche d8417ee90c Improve performance of video bookmarks (#662)
* Improve performance of video bookmarks

* remove test code
2025-06-20 11:53:41 -04:00
Brahim Hadriche 63f8ba8617 [skip ci] Small refactor 2025-06-20 09:20:49 -04:00
Brahim Hadriche a49f7e8d99 [skip ci] Revert "Set visitor data through launch args"
This reverts commit 4926c3df5b.
2025-06-19 14:18:50 -04:00
37 changed files with 1050 additions and 704 deletions

No files matched your search

+11
View File
@@ -5,6 +5,17 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.40.6] - 2025-06-21
### Fixed
- Improve performance of video bookmarks, by avoiding `/player` endpoint and caching results
- Github link to create new issue not working in web app due to url being too long
### Changed
- Added instructions to use web app as a workaround to current errors
## [0.40.5] - 2025-06-19
### Added
+1 -1
View File
@@ -19,7 +19,7 @@ These are mostly the steps when releasing a new version:
- Wait for the PR to be created
- Inspect PR, wait for CI and merge
- Wait for CI on main branch to create the `canary` release
- Edit `canary` release
- Edit [`canary`](https://github.com/iBicha/playlet/releases/tag/canary) release
- Tag: `v$VERSION`
- Title: `v$VERSION`
- Body: the content from CHANGELOG.md for this version
+646 -566
View File
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -1,18 +1,17 @@
{
"name": "playlet",
"version": "0.40.5",
"version": "0.40.6",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.32",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.0.1",
"@types/node": "^24.0.3",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.15",
"cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4",
"convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0",
"dotenv": "^16.5.0",
"fs-extra": "^11.3.0",
@@ -22,6 +21,7 @@
"json5": "^2.2.3",
"mailparser": "^3.7.3",
"protocol-buffers-schema": "^3.6.0",
"puppeteer": "^24.10.2",
"roku-deploy": "^3.12.6",
"roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7",
@@ -65,7 +65,7 @@
"convert-images": "node tools/convert-images.js",
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject tailwindcss,cheerio,brighterscript,daisyui",
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject tailwindcss,brighterscript,daisyui",
"registry:write": "node tools/registry.js --input registry.json",
"registry:read": "node tools/registry.js --output registry.json",
"registry:clear": "node tools/registry.js --clear",
@@ -74,6 +74,6 @@
"shutdown": "node tools/shutdown.js"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.43.0"
"@rollup/rollup-linux-x64-gnu": "^4.44.0"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.40.5",
"version": "0.40.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.40.5"
"version": "0.40.6"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.40.5",
"version": "0.40.6",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-app",
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=40
build_version=00005
build_version=00006
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.40.5",
"version": "0.40.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.40.5"
"version": "0.40.6"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.40.5",
"version": "0.40.6",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -187,9 +187,8 @@ function OnSubscribeButtonSelected()
subscribe: not m.top.isSubscribed
}
callback = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SubscribeJob, input, callback)
m.subscribeJob = callback
m.subscribeJob = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SubscribeJob, input, m.subscribeJob)
end function
function OnBannerLoadStatus() as void
@@ -407,9 +406,8 @@ function FetchSubscriptionStatus() as void
invidious: m.invidious
}
callback = JobSystem.CreateCallback(OnFetchSubscriptionStatusDone)
JobSystem.QueueJob(m.jobQueue, Jobs.FetchSubscriptionStatusJob, input, callback)
m.fetchSubscriptionStatusJob = callback
m.fetchSubscriptionStatusJob = JobSystem.CreateCallback(OnFetchSubscriptionStatusDone)
JobSystem.QueueJob(m.jobQueue, Jobs.FetchSubscriptionStatusJob, input, m.fetchSubscriptionStatusJob)
end function
function OnFetchSubscriptionStatusDone(event as object) as void
@@ -23,9 +23,8 @@ function LoadChannel(invidiousNode as object, jobQueue as object) as void
invidious: invidiousNode
}
callback = JobSystem.CreateCallback(OnChannelContentJobDone)
JobSystem.QueueJob(jobQueue, Jobs.ChannelContentJob, input, callback)
m.channelContentJob = callback
m.channelContentJob = JobSystem.CreateCallback(OnChannelContentJobDone)
JobSystem.QueueJob(jobQueue, Jobs.ChannelContentJob, input, m.channelContentJob)
end function
function OnChannelContentJobDone(event as object) as void
@@ -33,10 +33,9 @@ function LoadPlaylist(invidiousNode as object, jobQueue as object, singlePage as
singlePage: singlePage
}
callback = JobSystem.CreateCallback(OnPlaylistContentJobDone)
JobSystem.QueueJob(jobQueue, Jobs.PlaylistContentJob, input, callback)
m.playlistContentJob = callback
m.top.isLoading = true
m.playlistContentJob = JobSystem.CreateCallback(OnPlaylistContentJobDone)
JobSystem.QueueJob(jobQueue, Jobs.PlaylistContentJob, input, m.playlistContentJob)
end function
function OnPlaylistContentJobDone(event as object) as void
@@ -57,9 +57,8 @@ function RefreshAccessToken() as void
}
}
callback = JobSystem.CreateCallback(OnProfileRefreshTokenJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.ProfileRefreshTokenJob, input, callback)
m.profileRefreshTokenJob = callback
m.profileRefreshTokenJob = JobSystem.CreateCallback(OnProfileRefreshTokenJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.ProfileRefreshTokenJob, input, m.profileRefreshTokenJob)
end function
function OnProfileRefreshTokenJobDone(event as object) as void
@@ -23,12 +23,28 @@ namespace DialogUtils
if options.DoesExist("message")
message = options.message
if GetInterface(message, "ifArray") = invalid
if IsString(message)
message = message.Tokenize(`\n`).ToArray()
end if
dialog.message = message
end if
if options.DoesExist("bulletText")
bulletText = options.bulletText
if IsString(bulletText)
bulletText = bulletText.Tokenize(`\n`).ToArray()
end if
dialog.bulletText = bulletText
end if
if options.DoesExist("bottomMessage")
bottomMessage = options.bottomMessage
if IsString(bottomMessage)
bottomMessage = bottomMessage.Tokenize(`\n`).ToArray()
end if
dialog.bottomMessage = bottomMessage
end if
if options.DoesExist("title")
dialog.title = options.title
end if
+1 -11
View File
@@ -3,6 +3,7 @@ import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function InitEcpArgs()
m.videoQueue = m.top.findNode("VideoQueue")
LaunchArgumentsReceived()
m.scene.ObserveField("inputArgs", FuncName(InputArgumentsReceived))
@@ -28,14 +29,6 @@ function ProcessArguments(args as object) as void
return
end if
if not StringUtils.IsNullOrEmpty(args.visitorData)
if m.innertube = invalid
m.innertube = m.top.findNode("InnerTube")
end if
m.innertube.visitorData = args.visitorData
end if
if not StringUtils.IsNullOrEmpty(args.contentId) and StringUtils.IsNullOrEmpty(args.videoId)
args.videoId = args.contentId
end if
@@ -50,9 +43,6 @@ function ProcessArguments(args as object) as void
if args.timestamp <> invalid
node.timestamp = args.timestamp
end if
if m.videoQueue = invalid
m.videoQueue = m.top.findNode("VideoQueue")
end if
m.videoQueue.playVideo = node
end if
end function
+17 -9
View File
@@ -33,7 +33,7 @@ function SetScenePalette(scene as object) as void
scene.palette = palette
end function
const HAS_ANNOUNCEMENT = false
const HAS_ANNOUNCEMENT = true
function MainSceneContainerChanged()
AutoBindSceneGraph()
@@ -62,18 +62,26 @@ function StartWebServer()
end function
function ShowAnnouncement() as boolean
deviceInfo = CreateObject("roDeviceInfo")
deviceName = deviceInfo.GetFriendlyName()
dialog = DialogUtils.ShowDialogOnce({
messageId: "1747362859"
title: "Announcement - YouTube account support"
messageId: "1750501488"
title: "Web app workaround"
message: [
"YouTube account support is now available in Playlet!"
`Subscriptions, playlists, watch history and "Recommended" are now available in the app.`
"If you encounter any issues, please report them on GitHub."
"https://github.com/iBicha/playlet/issues"
"Thank you."
"If you're experiencing issues playing videos, please consider this workaround while we work on a fix:"
]
bulletText: [
`Go to the "Remote" screen, and scan the QR code to open the web app in your browser.`
`Tap the video you want to play.`
`Select the "Play on ${deviceName} (ytjs)" button.`
]
bottomMessage: [
"Apologies for the inconvenience, and thank you for your patience!"
"Issue link: https://github.com/iBicha/playlet/issues/626"
]
alwaysOnTop: true
marginWidth: 180
large: true
})
if dialog = invalid
@@ -38,7 +38,7 @@ function MainSceneContainerChanged()
StartWebServer()
HideLoadingScreen()
InitEcpArgs()
if false
if true
if not ShowAnnouncement()
m.scene.signalBeacon("AppLaunchComplete")
end if
@@ -58,18 +58,25 @@ function StartWebServer()
end function
function ShowAnnouncement() as boolean
deviceInfo = CreateObject("roDeviceInfo")
deviceName = deviceInfo.GetFriendlyName()
dialog = DialogUtils_ShowDialogOnce({
messageId: "1747362859"
title: "Announcement - YouTube account support"
messageId: "1750501488"
title: "Web app workaround"
message: [
"YouTube account support is now available in Playlet!"
"Subscriptions, playlists, watch history and " + chr(34) + "Recommended" + chr(34) + " are now available in the app."
"If you encounter any issues, please report them on GitHub."
"https://github.com/iBicha/playlet/issues"
"Thank you."
"If you're experiencing issues playing videos, please consider this workaround while we work on a fix:"
]
bulletText: [
"Go to the " + chr(34) + "Remote" + chr(34) + " screen, and scan the QR code to open the web app in your browser."
"Tap the video you want to play."
("Select the " + chr(34) + "Play on " + bslib_toString(deviceName) + " (ytjs)" + chr(34) + " button.")
]
bottomMessage: [
"Apologies for the inconvenience, and thank you for your patience!"
"Issue link: https://github.com/iBicha/playlet/issues/626"
]
alwaysOnTop: true
marginWidth: 180
large: true
})
if dialog = invalid
return false
@@ -188,9 +188,8 @@ function GeneratePairingCode()
deviceId: m.loungeService.deviceId
}
callback = JobSystem.CreateCallback(OnLoungeGenerateManualPairingCodeJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.LoungeGenerateManualPairingCodeJob, input, callback)
m.loungeGenerateManualPairingCodeJob = callback
m.loungeGenerateManualPairingCodeJob = JobSystem.CreateCallback(OnLoungeGenerateManualPairingCodeJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.LoungeGenerateManualPairingCodeJob, input, m.loungeGenerateManualPairingCodeJob)
end function
function OnLoungeGenerateManualPairingCodeJobDone(event as object) as void
@@ -111,9 +111,8 @@ function OnTextChange() as void
"searchScreen": m.top
}
callback = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SearchSuggestionsJob, input, callback)
m.searchSuggestionsJob = callback
m.searchSuggestionsJob = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SearchSuggestionsJob, input, m.searchSuggestionsJob)
end function
function OnSearchSuggestions(event as object) as void
@@ -132,7 +132,7 @@ function Close()
end function
function OnCategorySelected(event as object) as void
itemSelected = m.categoryList.itemSelected
itemSelected = event.GetData()
itemNode = m.categoryList.content.GetChild(itemSelected)
if itemNode = invalid
LogError("Invalid item selected:", itemSelected)
@@ -109,6 +109,10 @@ end function
function AddVideoBookmark(id as string, groupName as string)
bookmarkGroupNode = GetOrCreateBookmarkGroup(groupName)
' TODO:P1 instead of just storying the video id, we should store
' enough metadata for display (videoId, author, authorId, title,
' duration, isLive) that way all data is offline and avoid making
' a request altogether.
feedSource = {
"apiType": "Invidious"
"endpoint": "video_info"
@@ -24,9 +24,8 @@ function OnRequestVisitorData() as void
innertube: m.top
}
callback = JobSystem.CreateCallback(OnInnertubeSessionDataJobDone)
JobSystem.QueueJob(m.top.jobQueue, Jobs.InnertubeSessionDataJob, input, callback)
m.innertubeSessionDataJob = callback
m.innertubeSessionDataJob = JobSystem.CreateCallback(OnInnertubeSessionDataJobDone)
JobSystem.QueueJob(m.top.jobQueue, Jobs.InnertubeSessionDataJob, input, m.innertubeSessionDataJob)
end function
function OnInnertubeSessionDataJobDone(event as object) as void
@@ -113,33 +113,50 @@ namespace InnertubeService
}
end if
responseData = ObjectUtils.Dig(responseData, ["contents", "twoColumnWatchNextResults", "playlist", "playlist"])
if responseData = invalid
' Sometimes the response doesn't contain a playlist.
' The theory here is that when a private video is in the list, the created playlist
' is no longer publicly available. That's why it is not returned. Also happens with
' a deleted video.
' A retry after a short sleep SOMETIMES fixes this (but not always).
' TODO:P1: Figure out why this happens and if there's a better way to handle it.
if retry
LogWarn("Response data missing playlist. Retrying in a bit...")
newOptions = {}
if options <> invalid
newOptions.Append(options)
' If we're fetching more than one video, we want to search for the playlist
if videoIds.Count() > 1
responseData = ObjectUtils.Dig(responseData, ["contents", "twoColumnWatchNextResults", "playlist", "playlist"])
if responseData = invalid
' Sometimes the response doesn't contain a playlist.
' The theory here is that when a private video is in the list, the created playlist
' is no longer publicly available. That's why it is not returned. Also happens with
' a deleted video.
' A retry after a short sleep SOMETIMES fixes this (but not always).
' TODO:P1: Figure out why this happens and if there's a better way to handle it.
if retry
LogWarn("Response data missing playlist. Retrying in a bit...")
newOptions = {}
if options <> invalid
newOptions.Append(options)
end if
newOptions["retry"] = false
sleep(200 + Rnd(500))
return GetVideoInfoBatched(videoIds, newOptions)
else
LogWarn("Response data missing playlist. Not retrying.")
end if
newOptions["retry"] = false
sleep(200 + Rnd(500))
return GetVideoInfoBatched(videoIds, newOptions)
else
LogWarn("Response data missing playlist. Not retrying.")
end if
end if
feeds = Innertube.ParseResponseDataForFeeds(responseData)
if feeds.Count() > 0
return {
videos: ValidArray(feeds[0].items)
}
if videoIds.Count() > 1
if feeds.Count() > 0
return {
videos: ValidArray(feeds[0].items)
}
end if
else
if feeds.Count() > 0
foundVideos = feeds[0].items
for each video in foundVideos
if video.videoId = videoIds[0]
return {
videos: [video]
}
end if
end for
end if
end if
return {
@@ -44,6 +44,7 @@ namespace Innertube
"twoColumnSearchResultsRenderer": ParseTwoColumnSearchResultsRenderer
"singleColumnBrowseResultsRenderer": ParseSingleColumnBrowseResultsRenderer
"twoColumnBrowseResultsRenderer": ParseTwoColumnBrowseResultsRenderer
"twoColumnWatchNextResults": ParseTwoColumnWatchNextResults
"watchNextEndScreenRenderer": ParseWatchNextEndScreenRenderer
"tabRenderer": ParseTabRenderer
"sectionListRenderer": ParseSectionListRenderer
@@ -61,6 +62,8 @@ namespace Innertube
"playlistVideoListContinuation": ParsePlaylistVideoListContinuation
"videoRenderer": ParseVideoRenderer
"gridVideoRenderer": ParseGridVideoRenderer
"compactVideoRenderer": ParseCompactVideoRenderer
"videoPrimaryInfoRenderer": ParseVideoPrimaryInfoRenderer
"channelVideoPlayerRenderer": ParseChannelVideoPlayerRenderer
"playlistVideoRenderer": ParsePlaylistVideoRenderer
"playlistPanelVideoRenderer": ParsePlaylistPanelVideoRenderer
@@ -88,6 +91,14 @@ namespace Innertube
"gridContinuation": ParseGridContinuation
"tvSurfaceContentContinuation": ParseTvSurfaceContentContinuation
' Ignored nodes:
' Contains comments "teaser".
"commentsEntryPointHeaderRenderer": ParseNotImplemented
' Contains the owner of the video from "videoPrimaryInfoRenderer"
"videoSecondaryInfoRenderer": ParseNotImplemented
' Empty node? Perhaps used in some cases
"compositeVideoPrimaryInfoRenderer": ParseNotImplemented
' An information panel, could contain a link to some website, or a message.
"infoPanelContainerRenderer": ParseNotImplemented
' When you mispell something in the search bar, this renderer shows
"didYouMeanRenderer": ParseNotImplemented
' A list of subscribers in a channel with a CTA to subscribe.
@@ -118,6 +129,7 @@ namespace Innertube
"searchBarRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented
"promoShelfRenderer": ParseNotImplemented
"merchandiseShelfRenderer": ParseNotImplemented
"statementBannerRenderer": ParseNotImplemented
"adSlotRenderer": ParseNotImplemented
"adsControlFlowOpportunityReceivedCommand": ParseNotImplemented
@@ -136,6 +148,32 @@ namespace Innertube
return nodeData["tabs"]
end function
function ParseTwoColumnWatchNextResults(nodeData as object, _context as object) as object
subItems = []
results = ObjectUtils.Dig(nodeData, ["results", "results", "contents"])
if results <> invalid
subItems.Push(results)
end if
secondaryResults = ObjectUtils.Dig(nodeData, ["secondaryResults", "secondaryResults", "results"])
if secondaryResults <> invalid
subItems.Push(secondaryResults)
end if
' Technically, this playlist would have its own title, and should count as a separate feed.
' For now, we just add it to the current feed.
playlist = ObjectUtils.Dig(nodeData, ["playlist", "playlist", "contents"])
if playlist <> invalid
subItems.Push(playlist)
end if
if subItems.Count() = 0
LogWarn("No results found in TwoColumnWatchNextResults", nodeData)
return invalid
end if
return subItems
end function
function ParseWatchNextEndScreenRenderer(nodeData as object, _context as object) as object
return nodeData["results"]
end function
@@ -267,7 +305,7 @@ namespace Innertube
function ParseVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -369,7 +407,7 @@ namespace Innertube
function ParseGridVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -451,10 +489,141 @@ namespace Innertube
return invalid
end function
function ParseCompactVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
author = invalid
authorId = invalid
authorPossibleNodes = ["ownerText", "shortBylineText", "longBylineText"]
for each authorPossibleNode in authorPossibleNodes
node = nodeData[authorPossibleNode]
author = ParseText(node)
authorId = ObjectUtils.Dig(node, ["runs", 0, "navigationEndpoint", "browseEndpoint", "browseId"])
if author <> "" and authorId <> invalid
exit for
end if
end for
viewCountText = ParseText(nodeData["shortViewCountText"])
if viewCountText = ""
viewCountText = ParseText(nodeData["viewCountText"])
end if
publishedText = ParseText(nodeData["publishedTimeText"])
lengthText = ParseText(nodeData["lengthText"])
if lengthText = ""
thumbnailOverlays = nodeData["thumbnailOverlays"]
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
if parsedTimeStatusRenderer <> invalid
lengthText = parsedTimeStatusRenderer.text
if lengthText <> ""
exit for
end if
end if
end for
end if
end if
if context.generateVideoThumbnails = true
videoThumbnails = GenerateVideoThumbnails(videoId)
else
videoThumbnails = ObjectUtils.Dig(nodeData, ["thumbnail", "thumbnails"])
if videoThumbnails = invalid
videoThumbnails = GenerateVideoThumbnails(videoId)
end if
end if
isUpcoming = false
liveNow = ValidString(ObjectUtils.Dig(nodeData, ["badges", 0, "metadataBadgeRenderer", "icon", "iconType"])) = "LIVE"
thumbnailOverlays = nodeData["thumbnailOverlays"]
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
parsedTimeStatusRenderer = ParseThumbnailOverlayTimeStatusRenderer(overlay)
if parsedTimeStatusRenderer <> invalid
if parsedTimeStatusRenderer.isShort
if context.disableShorts = true
LogInfo("Skipping Short based on user settings")
return invalid
end if
end if
liveNow = liveNow or parsedTimeStatusRenderer.isLive
isUpcoming = isUpcoming or parsedTimeStatusRenderer.isUpcoming
end if
end for
end if
premiereTimestamp = ObjectUtils.Dig(nodeData, ["upcomingEventData", "startTime"])
if IsString(premiereTimestamp)
premiereTimestamp = premiereTimestamp.ToInt()
isUpcoming = true
end if
video = {
"type": "video"
"videoId": videoId
"author": author
"authorId": authorId
"title": ParseText(nodeData["title"])
"videoThumbnails": videoThumbnails
"viewCountText": viewCountText
"publishedText": publishedText
"lengthText": lengthText
"liveNow": liveNow
}
if isUpcoming
video["isUpcoming"] = true
video["premiereTimestamp"] = premiereTimestamp
end if
PushFeedItem(video, context)
return invalid
end function
function ParseVideoPrimaryInfoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
videoId = ObjectUtils.Dig(nodeData, ["updatedMetadataEndpoint", "updatedMetadataEndpoint", "videoId"])
if not IsString(videoId)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
end if
title = ParseText(nodeData["title"])
videoThumbnails = GenerateVideoThumbnails(videoId)
publishedText = ParseText(nodeData["relativeDateText"])
if publishedText = ""
publishedText = ParseText(nodeData["dateText"])
end if
viewCountText = ParseText(ObjectUtils.Dig(nodeData, ["viewCount", "videoViewCountRenderer", "viewCount"]))
' TODO:P2 the owner of the video is under videoSecondaryInfoRenderer in a neibouring node.
video = {
"type": "video"
"videoId": videoId
"title": title
"videoThumbnails": videoThumbnails
"viewCountText": viewCountText
"publishedText": publishedText
}
PushFeedItem(video, context)
return invalid
end function
function ParseChannelVideoPlayerRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -483,7 +652,7 @@ namespace Innertube
function ParsePlaylistVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -532,7 +701,7 @@ namespace Innertube
function ParsePlaylistPanelVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -598,7 +767,7 @@ namespace Innertube
function ParseEndScreenVideoRenderer(nodeData as object, context as object) as object
videoId = nodeData["videoId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -930,7 +1099,7 @@ namespace Innertube
videoId = ObjectUtils.Dig(nodeData, ["onTap", "innertubeCommand", "reelWatchEndpoint", "videoId"])
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -1017,7 +1186,7 @@ namespace Innertube
function TileRendererTypeVideo(nodeData as object, context as object) as object
videoId = nodeData["contentId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -1106,7 +1275,7 @@ namespace Innertube
videoId = nodeData["contentId"]
if not IsString(videoId)
LogWarn("Invalid video ID", nodeData)
LogWarn("Invalid video ID", `\n`, FormatJson(nodeData))
return invalid
end if
@@ -26,6 +26,7 @@ namespace Innertube
"autoCaptionsDefaultOn": false
"html5Preference": "HTML5_PREF_WANTS"
"lactMilliseconds": "-1"
"isInlinePlaybackNoAd": true
}
}
"attestationRequest": {
@@ -228,8 +228,8 @@ function InitContent() as void
}
callback = JobSystem.CreateCallback(OnVideoRowListContentJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.VideoRowListContentJob, input, callback)
m.pendingLoadJobs[callback.id] = { callback: callback }
JobSystem.QueueJob(m.jobQueue, Jobs.VideoRowListContentJob, input, callback)
end function
function CancelCurrentJobs()
@@ -316,8 +316,8 @@ function LoadRowContent(contentNode as object) as void
}
callback = JobSystem.CreateCallback(OnVideoRowListRowContentJobDone)
JobSystem.QueueJob(m.jobQueue, Jobs.VideoRowListRowContentJob, input, callback)
m.pendingLoadJobs[callback.id] = { callback: callback, content: contentNode }
JobSystem.QueueJob(m.jobQueue, Jobs.VideoRowListRowContentJob, input, callback)
end function
function OnVideoRowListRowContentJobDone(event as object) as void
@@ -217,9 +217,8 @@ namespace SponsorBlock
m.sponsorSkipEventJob.cancel = true
end if
callback = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SponsorBlockSegmentViewedJob, { segmentId: segmentId }, callback)
m.sponsorSkipEventJob = callback
m.sponsorSkipEventJob = JobSystem.CreateCallback()
JobSystem.QueueJob(m.jobQueue, Jobs.SponsorBlockSegmentViewedJob, { segmentId: segmentId }, m.sponsorSkipEventJob)
end function
end namespace
@@ -29,7 +29,7 @@ function VideoContentTask(input as object) as object
messagePort = CreateObject("roMessagePort")
MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "visitorData", messagePort)
innertubeNode.requestVisitorData = true
message = wait(10000, messagePort)
message = wait(20000, messagePort)
innertubeNode.unobserveFieldScoped("visitorData")
if message = invalid
return {
@@ -26,10 +26,11 @@ function VideoQueueViewContentTask(input as object) as object
visitorData: innertubeNode.visitorData
}
' TODO:P1: Use InnertubeService.GetVideoInfoBatched instead of loading each video individually
' TODO:P1: Use InnertubeService.GetVideoInfoBatched with an array instead of loading each video individually
' TODO:P1: It turns out this might be too much. With a large number of videos
' YouTube starts to rate limit us.
' Need to change it to load on demand using render tracking
' Or maybe not load this stuff at all.
for i = index to videoNodes.Count() - 1
videoNode = videoNodes[i]
if not LoadVideoDetail(videoNode, service, instance, requestOptions, backend)
@@ -57,12 +58,19 @@ function VideoQueueViewContentTask(input as object) as object
return invalid
end function
' Returns true if the video was loaded from cache.
function LoadVideoDetail(videoNode as object, service as object, instance as string, requestOptions as object, backend as string) as boolean
videoId = videoNode.videoId
if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(videoId, requestOptions)
requestOptions["retry"] = false
metadata = InnertubeService.GetVideoInfoBatched([videoId], requestOptions)
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 = service.GetVideoMetadata(videoId, requestOptions)
end if
@@ -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
@@ -96,6 +96,10 @@ video_info:
url: /api/v1/videos/{id}
responseHandler: VideoInfoHandler
cacheSeconds: 259200 # 3 days
queryParams:
video_info_batched:
type: boolean
default: true
playlist_info:
title: Playlist
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=40
build_version=00005
build_version=00006
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+18 -18
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.40.5",
"version": "0.40.6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.40.5",
"version": "0.40.6",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.1.0",
"@tailwindcss/typography": "^0.5.16",
@@ -17,12 +17,12 @@
"daisyui": "^4.12.23",
"dotenv": "^16.5.0",
"ip": "^2.0.1",
"postcss": "^8.5.5",
"svelte": "^5.34.1",
"svelte-check": "^4.2.1",
"postcss": "^8.5.6",
"svelte": "^5.34.7",
"svelte-check": "^4.2.2",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.42.0",
"terser": "^5.43.1",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.5",
@@ -3811,9 +3811,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.5",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.5.tgz",
"integrity": "sha512-d/jtm+rdNT8tpXuHY5MMtcbJFBkhXE6593XVR9UoGCH8jSFGci7jGvMGH5RYd5PBJW+00NZQt6gf7CbagJCrhg==",
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"dev": true,
"funding": [
{
@@ -4416,9 +4416,9 @@
}
},
"node_modules/svelte": {
"version": "5.34.1",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.34.1.tgz",
"integrity": "sha512-jWNnN2hZFNtnzKPptCcJHBWrD9CtbHPDwIRIODufOYaWkR0kLmAIlM384lMt4ucwuIRX4hCJwD2D8ZtEcGJQ0Q==",
"version": "5.34.7",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.34.7.tgz",
"integrity": "sha512-5PEg+QQKce4t1qiOtVUhUS3AQRTtxJyGBTpxLcNWnr0Ve8q4r06bMo0Gv8uhtCPWlztZHoi3Ye7elLhu+PCTMg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4442,9 +4442,9 @@
}
},
"node_modules/svelte-check": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.2.1.tgz",
"integrity": "sha512-e49SU1RStvQhoipkQ/aonDhHnG3qxHSBtNfBRb9pxVXoa+N7qybAo32KgA9wEb2PCYFNaDg7bZCdhLD1vHpdYA==",
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.2.2.tgz",
"integrity": "sha512-1+31EOYZ7NKN0YDMKusav2hhEoA51GD9Ws6o//0SphMT0ve9mBTsTUEX7OmDMadUP3KjNHsSKtJrqdSaD8CrGQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4637,9 +4637,9 @@
}
},
"node_modules/terser": {
"version": "5.42.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.42.0.tgz",
"integrity": "sha512-UYCvU9YQW2f/Vwl+P0GfhxJxbUGLwd+5QrrGgLajzWAtC/23AX0vcise32kkP7Eu0Wu9VlzzHAXkLObgjQfFlQ==",
"version": "5.43.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
"integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.40.5",
"version": "0.40.6",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,12 +18,12 @@
"daisyui": "^4.12.23",
"dotenv": "^16.5.0",
"ip": "^2.0.1",
"postcss": "^8.5.5",
"svelte": "^5.34.1",
"svelte-check": "^4.2.1",
"postcss": "^8.5.6",
"svelte": "^5.34.7",
"svelte-check": "^4.2.2",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.42.0",
"terser": "^5.43.1",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.5",
+1 -1
View File
@@ -4,7 +4,7 @@ export class PlayletApi {
static host = () => `http://${getHost()}`
static async getVideoInfo(videoId) {
const response = await fetch(`${PlayletApi.host()}/playlet-invidious-backend/api/v1/videos/${videoId}`);
const response = await fetch(`${PlayletApi.host()}/playlet-invidious-backend/api/v1/videos/${videoId}?video_info_batched=true`);
return await response.json();
}
+17 -2
View File
@@ -138,8 +138,23 @@ ${JSON.stringify(profilesInfo, null, 2)}
}
function createGithubIssueUrl() {
const body = encodeURIComponent(createFeedbackBody());
return `https://github.com/iBicha/playlet/issues/new?title=${feedbackTitle}&body=${body}`;
const body = createFeedbackBody();
let bodyEncoded = encodeURIComponent(body);
// Github url known limit is 8192
// Limit body, otherwise URL might be too long
// This is an body arbitrary limit, that should keep us under the 8192 limit
const encodedBodyLimit = 8000;
const bodyLimit = 4200;
if (bodyEncoded.length > encodedBodyLimit) {
bodyEncoded = encodeURIComponent(
body.substring(0, bodyLimit) + "\n\n[...truncated]"
);
}
const url = `https://github.com/iBicha/playlet/issues/new?title=${feedbackTitle}&body=${bodyEncoded}`;
console.log("Github URL length:", url.length);
return url;
}
function createMailToUrl() {
+5 -1
View File
@@ -7,6 +7,7 @@ const { existsSync, writeFileSync, readFileSync } = require('fs');
const json5 = require('json5');
const md5 = require('crypto-js/md5');
const path = require('path');
const { executablePath } = require('puppeteer');
const META_EXT = '.meta.json5';
@@ -116,7 +117,10 @@ function checkFileHash(file, hash) {
}
async function generateImage(inputImage, options, rootDir) {
const opts = { ...options };
const opts = {
launch: { executablePath },
...options
};
opts.outputFilePath = path.join(rootDir, opts.outputFilePath);
await convertFile(inputImage, opts);
}