diff --git a/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml b/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml
index aded68fc..30c59b3a 100644
--- a/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml
+++ b/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml
@@ -19,7 +19,7 @@
+ translation="[164,40]">
diff --git a/playlet-lib/src/components/Services/Innertube/NodesParser.bs b/playlet-lib/src/components/Services/Innertube/NodesParser.bs
index 78a7ef01..1c098543 100644
--- a/playlet-lib/src/components/Services/Innertube/NodesParser.bs
+++ b/playlet-lib/src/components/Services/Innertube/NodesParser.bs
@@ -54,6 +54,7 @@ namespace Innertube
"reelShelfRenderer": ParseReelShelfRenderer
"verticalListRenderer": ParseVerticalListRenderer
"horizontalListRenderer": ParseHorizontalListRenderer
+ "horizontalListContinuation": ParseHorizontalListContinuation
"expandedShelfContentsRenderer": ParseExpandedShelfContentsRenderer
"channelFeaturedContentRenderer": ParseChannelFeaturedContentRenderer
"playlistVideoListRenderer": ParsePlaylistVideoListRenderer
@@ -103,6 +104,9 @@ namespace Innertube
"messageRenderer": ParseNotImplemented
' Messages like "Videos you watch will be saved here"
"genericPromoRenderer": ParseNotImplemented
+ ' "Sign in to see the latest videos tailored to your interests"
+ "feedNudgeRenderer": ParseNotImplemented
+ "searchBarRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented
"promoShelfRenderer": ParseNotImplemented
"adSlotRenderer": ParseNotImplemented
@@ -181,8 +185,25 @@ namespace Innertube
return nodeData["items"]
end function
- function ParseHorizontalListRenderer(nodeData as object, _context as object) as object
- ' TODO: handle continuations
+ function ParseHorizontalListRenderer(nodeData as object, context as object) as object
+ continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
+ if IsString(continuation)
+ if not StringUtils.IsNullOrEmpty(context.currentFeed.continuation)
+ StartNewFeed("", context)
+ end if
+ context.currentFeed.continuation = continuation
+ end if
+ return nodeData["items"]
+ end function
+
+ function ParseHorizontalListContinuation(nodeData as object, context as object) as object
+ continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
+ if IsString(continuation)
+ if not StringUtils.IsNullOrEmpty(context.currentFeed.continuation)
+ StartNewFeed("", context)
+ end if
+ context.currentFeed.continuation = continuation
+ end if
return nodeData["items"]
end function
diff --git a/playlet-lib/src/components/Services/Preferences/Preferences.bs b/playlet-lib/src/components/Services/Preferences/Preferences.bs
index b8745d65..752f4c9a 100644
--- a/playlet-lib/src/components/Services/Preferences/Preferences.bs
+++ b/playlet-lib/src/components/Services/Preferences/Preferences.bs
@@ -122,6 +122,29 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true
end if
+ #if YT_OAUTH_SUPPORT
+ if userPrefs.__version = 2
+ if IsArray(userPrefs["misc.home_screen_layout"])
+ homeScreenLayout = userPrefs["misc.home_screen_layout"]
+ hasRecommended = false
+ for each item in homeScreenLayout
+ if item.id = "recommended"
+ hasRecommended = true
+ exit for
+ end if
+ end for
+ if not hasRecommended
+ homeScreenLayout.Unshift({
+ id: "recommended"
+ enabled: true
+ })
+ end if
+ end if
+ userPrefs.__version = 3
+ isDirty = true
+ end if
+ #end if
+
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
return isDirty
end function
diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs
index cf53ef8d..ec2c9599 100644
--- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs
+++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs
@@ -284,6 +284,11 @@ namespace Http
request = context.request
response = context.response
+ isRecommended = request.query.recommended = "true"
+ if isRecommended
+ return m.GetAuthRecommended(context)
+ end if
+
raw = request.query.raw <> invalid
options = {
@@ -319,6 +324,61 @@ namespace Http
return true
end function
+ function GetAuthRecommended(context as object) as boolean
+ request = context.request
+ response = context.response
+
+ accessToken = request.headers["authorization"]
+ if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
+ response.Json({
+ "error": "Missing or invalid 'Authorization' header"
+ })
+ response.http_code = 403
+ return true
+ end if
+
+ options = {
+ "accessToken": accessToken.Mid("Bearer ".Len())
+ }
+
+ continuation = request.query.continuation
+ if not StringUtils.IsNullOrEmpty(continuation)
+ options.continuation = continuation
+ end if
+
+ feeds = InnertubeService.GetHome(options)
+ if feeds = invalid
+ response.Json({
+ "error": "Failed to get auth home feed"
+ })
+ response.http_code = 500
+ return true
+ end if
+
+ if IsAssociativeArray(feeds)
+ if feeds.error <> invalid
+ response.Json(feeds)
+ response.http_code = 500
+ return true
+ end if
+ return true
+ end if
+
+ result = {
+ "items": []
+ }
+
+ if feeds.Count() > 0
+ result["items"] = ValidArray(feeds[0].items)
+ if feeds[0].DoesExist("continuation")
+ result["continuation"] = feeds[0].continuation
+ end if
+ end if
+
+ response.Json(result)
+ return true
+ end function
+
@get("/playlet-invidious-backend/api/v1/search/suggestions")
function GetSearchSuggestions(context as object) as boolean
request = context.request
diff --git a/playlet-lib/src/config/default_home_layout.yaml b/playlet-lib/src/config/default_home_layout.yaml
index c255d56e..7d676eee 100644
--- a/playlet-lib/src/config/default_home_layout.yaml
+++ b/playlet-lib/src/config/default_home_layout.yaml
@@ -6,6 +6,14 @@
apiType: Invidious
endpoint: auth_feed
+- title: Recommended
+ id: recommended
+ feedSources:
+ - id: inv_auth_recommended
+ title: Recommended
+ apiType: Invidious
+ endpoint: auth_recommended
+
- title: Trending
id: trending
feedSources:
diff --git a/playlet-lib/src/config/invidious_video_api.yaml b/playlet-lib/src/config/invidious_video_api.yaml
index 968c07cf..8aba4894 100644
--- a/playlet-lib/src/config/invidious_video_api.yaml
+++ b/playlet-lib/src/config/invidious_video_api.yaml
@@ -187,3 +187,16 @@ watch_history:
authenticated: true
paginationType: Pages
responseHandler: WatchHistoryHandler
+
+# Recommended is not a thing for Invidious, but we can use
+# /api/v1/popular?recommended=true and handle it in Playlet
+# backend. Invidious will just ignore the query param.
+auth_recommended:
+ title: Recommended
+ url: /api/v1/popular
+ authenticated: true
+ paginationType: Continuation
+ queryParams:
+ recommended:
+ type: boolean
+ default: true
diff --git a/playlet-lib/src/config/preferences.json5 b/playlet-lib/src/config/preferences.json5
index ae21f2a9..16d6dd3c 100644
--- a/playlet-lib/src/config/preferences.json5
+++ b/playlet-lib/src/config/preferences.json5
@@ -152,6 +152,11 @@
id: "subscriptions",
enabled: true,
},
+ // YT_OAUTH_SUPPORT
+ // {
+ // id: "recommended",
+ // enabled: true,
+ // },
{
id: "trending",
enabled: true,
diff --git a/playlet-lib/src/locale/en_US/translations.ts b/playlet-lib/src/locale/en_US/translations.ts
index 991b154d..43baf3d9 100644
--- a/playlet-lib/src/locale/en_US/translations.ts
+++ b/playlet-lib/src/locale/en_US/translations.ts
@@ -76,6 +76,10 @@
Subscriptions
Subscriptions
+
+ Recommended
+ Recommended
+
Playlists
Playlists
diff --git a/playlet-lib/src/source/utils/Locale.bs b/playlet-lib/src/source/utils/Locale.bs
index dd66fcdf..f419d6f6 100644
--- a/playlet-lib/src/source/utils/Locale.bs
+++ b/playlet-lib/src/source/utils/Locale.bs
@@ -38,6 +38,7 @@ namespace Locale
@locale
enum Feed
Subscriptions = "Subscriptions"
+ Recommended = "Recommended"
Playlists = "Playlists"
WatchHistory = "Watch history"
Trending = "Trending"