OAuth: recommended feed
This commit is contained in:
1 parent
fb030cee97
commit
e821464451
9 files changed
+138
-3
No files matched your search
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
<CheckList
|
<CheckList
|
||||||
id="checkList"
|
id="checkList"
|
||||||
vertFocusAnimationStyle="floatingFocus"
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
translation="[164,70]">
|
translation="[164,40]">
|
||||||
|
|
||||||
<ContentNode role="content" />
|
<ContentNode role="content" />
|
||||||
</CheckList>
|
</CheckList>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace Innertube
|
|||||||
"reelShelfRenderer": ParseReelShelfRenderer
|
"reelShelfRenderer": ParseReelShelfRenderer
|
||||||
"verticalListRenderer": ParseVerticalListRenderer
|
"verticalListRenderer": ParseVerticalListRenderer
|
||||||
"horizontalListRenderer": ParseHorizontalListRenderer
|
"horizontalListRenderer": ParseHorizontalListRenderer
|
||||||
|
"horizontalListContinuation": ParseHorizontalListContinuation
|
||||||
"expandedShelfContentsRenderer": ParseExpandedShelfContentsRenderer
|
"expandedShelfContentsRenderer": ParseExpandedShelfContentsRenderer
|
||||||
"channelFeaturedContentRenderer": ParseChannelFeaturedContentRenderer
|
"channelFeaturedContentRenderer": ParseChannelFeaturedContentRenderer
|
||||||
"playlistVideoListRenderer": ParsePlaylistVideoListRenderer
|
"playlistVideoListRenderer": ParsePlaylistVideoListRenderer
|
||||||
@@ -103,6 +104,9 @@ namespace Innertube
|
|||||||
"messageRenderer": ParseNotImplemented
|
"messageRenderer": ParseNotImplemented
|
||||||
' Messages like "Videos you watch will be saved here"
|
' Messages like "Videos you watch will be saved here"
|
||||||
"genericPromoRenderer": ParseNotImplemented
|
"genericPromoRenderer": ParseNotImplemented
|
||||||
|
' "Sign in to see the latest videos tailored to your interests"
|
||||||
|
"feedNudgeRenderer": ParseNotImplemented
|
||||||
|
"searchBarRenderer": ParseNotImplemented
|
||||||
"clickTrackingParams": ParseNotImplemented
|
"clickTrackingParams": ParseNotImplemented
|
||||||
"promoShelfRenderer": ParseNotImplemented
|
"promoShelfRenderer": ParseNotImplemented
|
||||||
"adSlotRenderer": ParseNotImplemented
|
"adSlotRenderer": ParseNotImplemented
|
||||||
@@ -181,8 +185,25 @@ namespace Innertube
|
|||||||
return nodeData["items"]
|
return nodeData["items"]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ParseHorizontalListRenderer(nodeData as object, _context as object) as object
|
function ParseHorizontalListRenderer(nodeData as object, context as object) as object
|
||||||
' TODO: handle continuations
|
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"]
|
return nodeData["items"]
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,29 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
|
|||||||
isDirty = true
|
isDirty = true
|
||||||
end if
|
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)
|
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
|
||||||
return isDirty
|
return isDirty
|
||||||
end function
|
end function
|
||||||
|
|||||||
+60
@@ -284,6 +284,11 @@ namespace Http
|
|||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
|
isRecommended = request.query.recommended = "true"
|
||||||
|
if isRecommended
|
||||||
|
return m.GetAuthRecommended(context)
|
||||||
|
end if
|
||||||
|
|
||||||
raw = request.query.raw <> invalid
|
raw = request.query.raw <> invalid
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
@@ -319,6 +324,61 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end function
|
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")
|
@get("/playlet-invidious-backend/api/v1/search/suggestions")
|
||||||
function GetSearchSuggestions(context as object) as boolean
|
function GetSearchSuggestions(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
apiType: Invidious
|
apiType: Invidious
|
||||||
endpoint: auth_feed
|
endpoint: auth_feed
|
||||||
|
|
||||||
|
- title: Recommended
|
||||||
|
id: recommended
|
||||||
|
feedSources:
|
||||||
|
- id: inv_auth_recommended
|
||||||
|
title: Recommended
|
||||||
|
apiType: Invidious
|
||||||
|
endpoint: auth_recommended
|
||||||
|
|
||||||
- title: Trending
|
- title: Trending
|
||||||
id: trending
|
id: trending
|
||||||
feedSources:
|
feedSources:
|
||||||
|
|||||||
@@ -187,3 +187,16 @@ watch_history:
|
|||||||
authenticated: true
|
authenticated: true
|
||||||
paginationType: Pages
|
paginationType: Pages
|
||||||
responseHandler: WatchHistoryHandler
|
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
|
||||||
@@ -152,6 +152,11 @@
|
|||||||
id: "subscriptions",
|
id: "subscriptions",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
// YT_OAUTH_SUPPORT
|
||||||
|
// {
|
||||||
|
// id: "recommended",
|
||||||
|
// enabled: true,
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
id: "trending",
|
id: "trending",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
@@ -76,6 +76,10 @@
|
|||||||
<source>Subscriptions</source>
|
<source>Subscriptions</source>
|
||||||
<translation>Subscriptions</translation>
|
<translation>Subscriptions</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Recommended</source>
|
||||||
|
<translation>Recommended</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Playlists</source>
|
<source>Playlists</source>
|
||||||
<translation>Playlists</translation>
|
<translation>Playlists</translation>
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace Locale
|
|||||||
@locale
|
@locale
|
||||||
enum Feed
|
enum Feed
|
||||||
Subscriptions = "Subscriptions"
|
Subscriptions = "Subscriptions"
|
||||||
|
Recommended = "Recommended"
|
||||||
Playlists = "Playlists"
|
Playlists = "Playlists"
|
||||||
WatchHistory = "Watch history"
|
WatchHistory = "Watch history"
|
||||||
Trending = "Trending"
|
Trending = "Trending"
|
||||||
|
|||||||
Reference in new issue
Block a user