Remove Trending endpoints from code base
This commit is contained in:
1 parent
aadbde330d
commit
1f2058abce
18 files changed
+26
-265
No files matched your search
+3
-1
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Nothing worth mentioning yet.
|
### Removed
|
||||||
|
|
||||||
|
- Trending endpoints from code base
|
||||||
|
|
||||||
## [0.44.3] - 2025-11-14
|
## [0.44.3] - 2025-11-14
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -324,7 +324,7 @@ end function
|
|||||||
|
|
||||||
function CanFetchWithCors(instance as string, testNode as object, cancellation as object) as void
|
function CanFetchWithCors(instance as string, testNode as object, cancellation as object) as void
|
||||||
try
|
try
|
||||||
url = `${instance}/api/v1/trending`
|
url = `${instance}/api/v1/popular`
|
||||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||||
|
|
||||||
if not response.IsSuccess()
|
if not response.IsSuccess()
|
||||||
|
|||||||
@@ -267,63 +267,6 @@ namespace InnertubeService
|
|||||||
return Innertube.Search(query, options)
|
return Innertube.Search(query, options)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetTrending(options = invalid as object) as object
|
|
||||||
cancellation = OptionUtils.Get(options, "cancellation")
|
|
||||||
trendingType = LCase(OptionUtils.GetOrDefault(options, "type", ""))
|
|
||||||
disableShorts = OptionUtils.GetOrDefault(options, "disableShorts", false)
|
|
||||||
raw = OptionUtils.GetOrDefault(options, "raw", false)
|
|
||||||
browseId = "FEtrending"
|
|
||||||
|
|
||||||
params = ""
|
|
||||||
if trendingType = "music"
|
|
||||||
' {"44:proto": {"3:string": "ytma_charts"}}
|
|
||||||
params = "4gINGgt5dG1hX2NoYXJ0cw%3D%3D"
|
|
||||||
else if trendingType = "gaming"
|
|
||||||
' {"44:proto": {"3:string": "gaming_corpus_most_popular"}}
|
|
||||||
params = "4gIcGhpnYW1pbmdfY29ycHVzX21vc3RfcG9wdWxhcg%3D%3D"
|
|
||||||
else if trendingType = "movies"
|
|
||||||
' {"44:proto": {"3:string": "trailers"}}
|
|
||||||
params = "4gIKGgh0cmFpbGVycw%3D%3D"
|
|
||||||
end if
|
|
||||||
|
|
||||||
request = Innertube.CreateBrowseRequest(browseId, Innertube.ClientType.WEB, { params: params })
|
|
||||||
request.Cancellation(cancellation)
|
|
||||||
|
|
||||||
if raw
|
|
||||||
request.LogCurlCommand(true)
|
|
||||||
request.NoCache()
|
|
||||||
end if
|
|
||||||
|
|
||||||
response = request.Await()
|
|
||||||
if not response.IsSuccess()
|
|
||||||
return {
|
|
||||||
error: response.ErrorMessage()
|
|
||||||
}
|
|
||||||
end if
|
|
||||||
|
|
||||||
if raw
|
|
||||||
return response.Json()
|
|
||||||
end if
|
|
||||||
|
|
||||||
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), {
|
|
||||||
response: response
|
|
||||||
disableCreatorOnTheRise: true
|
|
||||||
disableShorts: disableShorts
|
|
||||||
browseId: browseId
|
|
||||||
})
|
|
||||||
|
|
||||||
result = {
|
|
||||||
feeds: feeds
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheControl = Innertube.ParseResponseForCacheControl(response)
|
|
||||||
if cacheControl <> invalid
|
|
||||||
result["cache-control"] = cacheControl
|
|
||||||
end if
|
|
||||||
|
|
||||||
return result
|
|
||||||
end function
|
|
||||||
|
|
||||||
function GetHome(options = invalid as object) as object
|
function GetHome(options = invalid as object) as object
|
||||||
return GetBrowseAuthenticatedPage("FEwhat_to_watch", options)
|
return GetBrowseAuthenticatedPage("FEwhat_to_watch", options)
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -162,6 +162,20 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
|
|||||||
isDirty = true
|
isDirty = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if userPrefs.__version = 5
|
||||||
|
filteredLayout = []
|
||||||
|
homeScreenLayout = ValidArray(userPrefs["misc.home_screen_layout"])
|
||||||
|
for each item in homeScreenLayout
|
||||||
|
if item.id = "trending" or item.id = "trending_music" or item.id = "trending_gaming" or item.id = "trending_movies"
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
|
filteredLayout.Push(item)
|
||||||
|
end for
|
||||||
|
userPrefs["misc.home_screen_layout"] = filteredLayout
|
||||||
|
userPrefs.__version = 6
|
||||||
|
isDirty = true
|
||||||
|
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)
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
user prefs saved need to be migrated. If the version is less than the
|
user prefs saved need to be migrated. If the version is less than the
|
||||||
current version, a migration is needed.
|
current version, a migration is needed.
|
||||||
-->
|
-->
|
||||||
<field id="__version" type="integer" value="5" />
|
<field id="__version" type="integer" value="6" />
|
||||||
<field id="prefsModel" type="array" />
|
<field id="prefsModel" type="array" />
|
||||||
<field id="preferenceFields" type="assocarray" />
|
<field id="preferenceFields" type="assocarray" />
|
||||||
<function name="GetUserPreferences" />
|
<function name="GetUserPreferences" />
|
||||||
|
|||||||
@@ -230,10 +230,11 @@ function RemoveSingleFailedRow(error as dynamic, feedSource as object, feedSourc
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
isError = error = Invidious.ERROR_NOT_AUTHENTICATED
|
isError = error = Invidious.ERROR_NOT_AUTHENTICATED
|
||||||
|
' Invidious admins disable endpoints sometimes
|
||||||
isError = isError or error.instr("Administrator has disabled this endpoint") <> -1
|
isError = isError or error.instr("Administrator has disabled this endpoint") <> -1
|
||||||
isError = isError or error.instr("API disabled") <> -1
|
isError = isError or error.instr("API disabled") <> -1
|
||||||
isError = isError or feedSource.id.instr("inv_trending") <> -1
|
' Playlet not supporting popular
|
||||||
isError = isError or feedSource.id.instr("inv_popular") <> -1
|
isError = isError or feedSource.id = "inv_popular"
|
||||||
if not isError
|
if not isError
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|||||||
+3
-34
@@ -253,9 +253,8 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@get("/playlet-invidious-backend/api/v1/trending")
|
|
||||||
@get("/playlet-invidious-backend/api/v1/popular")
|
@get("/playlet-invidious-backend/api/v1/popular")
|
||||||
function GetTrending(context as object) as boolean
|
function GetPopular(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
@@ -264,40 +263,10 @@ namespace Http
|
|||||||
return m.GetAuthRecommended(context)
|
return m.GetAuthRecommended(context)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
raw = request.query.raw <> invalid
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"disableShorts": m.preferences["content_feed.disable_shorts"]
|
|
||||||
raw: raw
|
|
||||||
type: request.query.type
|
|
||||||
}
|
|
||||||
|
|
||||||
result = InnertubeService.GetTrending(options)
|
|
||||||
if raw
|
|
||||||
response.Json(result)
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
if result.error <> invalid
|
|
||||||
response.Json(result)
|
|
||||||
response.http_code = 500
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
if not IsArray(result.feeds) or result.feeds.Count() = 0
|
|
||||||
response.Json({
|
response.Json({
|
||||||
"error": "Failed to get trending feed"
|
"error": "Playlet built-in Invidious backend does not support popular videos."
|
||||||
})
|
})
|
||||||
response.http_code = 500
|
response.http_code = 400
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
response.Json(ValidArray(result.feeds[0].items))
|
|
||||||
|
|
||||||
if result.DoesExist("cache-control")
|
|
||||||
response.headers["cache-control"] = result["cache-control"]
|
|
||||||
end if
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -14,44 +14,6 @@
|
|||||||
apiType: Invidious
|
apiType: Invidious
|
||||||
endpoint: auth_recommended
|
endpoint: auth_recommended
|
||||||
|
|
||||||
- title: Trending
|
|
||||||
id: trending
|
|
||||||
feedSources:
|
|
||||||
- id: inv_trending
|
|
||||||
title: Trending
|
|
||||||
apiType: Invidious
|
|
||||||
endpoint: trending
|
|
||||||
|
|
||||||
- title: Trending - Music
|
|
||||||
id: trending_music
|
|
||||||
feedSources:
|
|
||||||
- id: inv_trending_music
|
|
||||||
title: Trending - Music
|
|
||||||
apiType: Invidious
|
|
||||||
endpoint: trending
|
|
||||||
queryParams:
|
|
||||||
type: Music
|
|
||||||
|
|
||||||
- title: Trending - Gaming
|
|
||||||
id: trending_gaming
|
|
||||||
feedSources:
|
|
||||||
- id: inv_trending_gaming
|
|
||||||
title: Trending - Gaming
|
|
||||||
apiType: Invidious
|
|
||||||
endpoint: trending
|
|
||||||
queryParams:
|
|
||||||
type: Gaming
|
|
||||||
|
|
||||||
- title: Trending - Movies
|
|
||||||
id: trending_movies
|
|
||||||
feedSources:
|
|
||||||
- id: inv_trending_movies
|
|
||||||
title: Trending - Movies
|
|
||||||
apiType: Invidious
|
|
||||||
endpoint: trending
|
|
||||||
queryParams:
|
|
||||||
type: Movies
|
|
||||||
|
|
||||||
- title: Popular
|
- title: Popular
|
||||||
id: popular
|
id: popular
|
||||||
feedSources:
|
feedSources:
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
trending:
|
|
||||||
title: Trending
|
|
||||||
url: /api/v1/trending
|
|
||||||
cacheSeconds: 21600 # 6 hours
|
|
||||||
queryParams:
|
|
||||||
type:
|
|
||||||
type:
|
|
||||||
- Music
|
|
||||||
- Gaming
|
|
||||||
- Movies
|
|
||||||
region:
|
|
||||||
type: "#ISO3166"
|
|
||||||
default: GetUserCountryCode
|
|
||||||
|
|
||||||
popular:
|
popular:
|
||||||
title: Popular
|
title: Popular
|
||||||
url: /api/v1/popular
|
url: /api/v1/popular
|
||||||
|
|||||||
@@ -243,22 +243,6 @@
|
|||||||
id: "recommended",
|
id: "recommended",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: "trending",
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "trending_music",
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "trending_gaming",
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "trending_movies",
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "popular",
|
id: "popular",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
@@ -312,22 +312,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Wiedergabeverlauf</translation>
|
<translation>Wiedergabeverlauf</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Trends</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Trends - Filme</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Trends - Musik</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Trends - Gaming</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Popular</source>
|
<source>Popular</source>
|
||||||
<translation>Populär</translation>
|
<translation>Populär</translation>
|
||||||
|
|||||||
@@ -88,22 +88,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Watch history</translation>
|
<translation>Watch history</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Trending</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Trending - Movies</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Trending - Music</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Trending - Gaming</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Popular</source>
|
<source>Popular</source>
|
||||||
<translation>Popular</translation>
|
<translation>Popular</translation>
|
||||||
|
|||||||
@@ -80,22 +80,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Ver el historial</translation>
|
<translation>Ver el historial</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Tendencias</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Tendencias - Películas</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Tendencias - Música</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Tendencias - Juegos</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Popular</source>
|
<source>Popular</source>
|
||||||
<translation>Popular</translation>
|
<translation>Popular</translation>
|
||||||
|
|||||||
@@ -36,10 +36,6 @@
|
|||||||
<source>Filters</source>
|
<source>Filters</source>
|
||||||
<translation>Filtros</translation>
|
<translation>Filtros</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Tendencias - Música</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history.</source>
|
<source>Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history.</source>
|
||||||
<translation>Accede a Invidious para ver tus suscripciones, playlists, y usar el historial de reproducción.</translation>
|
<translation>Accede a Invidious para ver tus suscripciones, playlists, y usar el historial de reproducción.</translation>
|
||||||
@@ -80,18 +76,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Historial de reproducción</translation>
|
<translation>Historial de reproducción</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Tendencias</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Tendencias - Películas</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Tendencias - Videojuegos</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Edit</source>
|
<source>Edit</source>
|
||||||
<translation>Editar</translation>
|
<translation>Editar</translation>
|
||||||
|
|||||||
@@ -76,22 +76,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Historique</translation>
|
<translation>Historique</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Tendances</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Tendances - Films</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Tendances - Musique</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Tendances - Jeux vidéo</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Popular</source>
|
<source>Popular</source>
|
||||||
<translation>Populaire</translation>
|
<translation>Populaire</translation>
|
||||||
|
|||||||
@@ -140,22 +140,6 @@
|
|||||||
<source>Watch history</source>
|
<source>Watch history</source>
|
||||||
<translation>Histórico de assistidos</translation>
|
<translation>Histórico de assistidos</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Trending</source>
|
|
||||||
<translation>Em alta</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Movies</source>
|
|
||||||
<translation>Em alta - Flimes</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Music</source>
|
|
||||||
<translation>Em alta - Música</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Trending - Gaming</source>
|
|
||||||
<translation>Em alta - Jogos</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Popular</source>
|
<source>Popular</source>
|
||||||
<translation>Popular</translation>
|
<translation>Popular</translation>
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ namespace Locale
|
|||||||
Recommended = "Recommended"
|
Recommended = "Recommended"
|
||||||
Playlists = "Playlists"
|
Playlists = "Playlists"
|
||||||
WatchHistory = "Watch history"
|
WatchHistory = "Watch history"
|
||||||
Trending = "Trending"
|
|
||||||
TrendingMovies = "Trending - Movies"
|
|
||||||
TrendingMusic = "Trending - Music"
|
|
||||||
TrendingGaming = "Trending - Gaming"
|
|
||||||
Popular = "Popular"
|
Popular = "Popular"
|
||||||
Videos = "Videos"
|
Videos = "Videos"
|
||||||
Shorts = "Shorts"
|
Shorts = "Shorts"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ services:
|
|||||||
# Use the key generated in the 2nd step
|
# Use the key generated in the 2nd step
|
||||||
hmac_key: $INVIDIOUS_HMAC_KEY
|
hmac_key: $INVIDIOUS_HMAC_KEY
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
|
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/popular || exit 1
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 2
|
retries: 2
|
||||||
|
|||||||
Reference in new issue
Block a user