skipCreatorOnTheRise: true

This commit is contained in:
Brahim Hadriche committed 2025-01-10 17:34:58 -05:00
1 parent 26774d5655
commit af4c28a411
5 files changed
+36 -17

No files matched your search

+6
View File
@@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Web app "Open in Invidious" when built-in backend is selected
- Playlist continuation showing invalid items at the end of playlists
## Changed
- Skip "Create on the Rise" that show up in trending
- They end up hijacking the feed
- Might become a setting in the future
## [0.35.5] - 2025-01-09
### Added
@@ -204,7 +204,7 @@ namespace InnertubeService
end if
json = response.Json()
feeds = Innertube.ParseResponseDataForFeeds(json)
feeds = Innertube.ParseResponseDataForFeeds(json, { skipCreatorOnTheRise: true })
result = {
feeds: feeds
@@ -115,7 +115,20 @@ namespace Innertube
return nodeData["contents"]
end function
function ParseShelfRenderer(nodeData as object, _context as object) as object
function ParseShelfRenderer(nodeData as object, context as object) as object
if context.skipCreatorOnTheRise = true
badges = nodeData["badges"]
if IsArray(badges)
for each badge in badges
if ValidString(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "style"])) = "BADGE_STYLE_TYPE_FEATURED"
label = ParseText(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "label"]))
LogInfo(`Skipping 'Create on the Rise' shelf (${label})`)
return invalid
end if
end for
end if
end if
' TODO: handle shelfRenderer.title
' TODO: handle shelfRenderer.headerRenderer.shelfHeaderRenderer.avatarLockup.avatarLockupRenderer.title
return nodeData["content"]
@@ -180,6 +180,7 @@ namespace Http
end function
@get("/playlet-invidious-backend/api/v1/trending")
@get("/playlet-invidious-backend/api/v1/popular")
function GetTrending(context as object) as boolean
request = context.request
response = context.response
@@ -207,13 +208,6 @@ namespace Http
return true
end function
@get("/playlet-invidious-backend/api/v1/popular")
function GetPopular(context as object) as boolean
response = context.response
response.Redirect("/playlet-invidious-backend/api/v1/trending")
return true
end function
@get("/playlet-invidious-backend/api/v1/search/suggestions")
function GetSearchSuggestions(context as object) as boolean
request = context.request
+14 -8
View File
@@ -72,8 +72,8 @@ export class WebServerPlugin implements CompilerPlugin {
return;
}
const routeInfo = this.getRouteInfo(functionStatement);
if (!routeInfo) {
const routeInfos = this.getRouteInfos(functionStatement);
if (!routeInfos || routeInfos.length === 0) {
return;
}
@@ -83,9 +83,12 @@ export class WebServerPlugin implements CompilerPlugin {
}
const classConstructor = this.getClassConstructor(classStmt) as MethodStatement;
const method = routeInfo.method === 'ALL' ? '*' : routeInfo.method;
const stmt = new RawCodeStatement(`m.routes.push({ method: "${method}", path: "${routeInfo.route}", router: m, func: "${func.functionStatement?.name.text}" })`)
event.editor.arrayPush(classConstructor.func.body.statements, stmt);
for (let index = 0; index < routeInfos.length; index++) {
const routeInfo = routeInfos[index];
const method = routeInfo.method === 'ALL' ? '*' : routeInfo.method;
const stmt = new RawCodeStatement(`m.routes.push({ method: "${method}", path: "${routeInfo.route}", router: m, func: "${func.functionStatement?.name.text}" })`)
event.editor.arrayPush(classConstructor.func.body.statements, stmt);
}
},
}), {
walkMode: WalkMode.visitExpressionsRecursive
@@ -102,12 +105,13 @@ export class WebServerPlugin implements CompilerPlugin {
return parentClass === httpRouterBaseClass;
}
getRouteInfo(functionStatement: FunctionStatement | undefined) {
getRouteInfos(functionStatement: FunctionStatement | undefined) {
const annotations = functionStatement?.annotations
if (!annotations || annotations.length === 0) {
return undefined
}
const routeInfos = [];
for (let index = 0; index < annotations.length; index++) {
const annotation = annotations[index];
if (annotationNames.includes(annotation.name)) {
@@ -120,12 +124,14 @@ export class WebServerPlugin implements CompilerPlugin {
throw new Error(`Expected string argument for annotation ${annotation.name}`)
}
return {
routeInfos.push({
method: annotation.name.toUpperCase(),
route: args[0]
}
});
}
}
return routeInfos;
}
getClass(func: FunctionExpression) {