Skip to content

Commit

Permalink
Restore playlist/channel handler
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Sep 5, 2023
1 parent 431703b commit f328fa2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ namespace Invidious

m.responseHanlders = {
DefaultHandler: m.DefaultHandler,
AuthFeedHandler: m.AuthFeedHandler
AuthFeedHandler: m.AuthFeedHandler,
PlaylistHandler: m.PlaylistHandler,
ChannelHandler: m.ChannelHandler
}
end function

Expand Down Expand Up @@ -243,6 +245,22 @@ namespace Invidious
return response.Json()
end function

function PlaylistHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return json.videos
end if
return invalid
end function

function ChannelHandler(m as object, requestData as object, response as object) as object
if response.StatusCode() = 200
json = response.Json()
return json.videos
end if
return invalid
end function

function AuthFeedHandler(m as object, requestData as object, response as object) as object
m.DeleteExpiredToken(response)

Expand Down
12 changes: 1 addition & 11 deletions playlet-lib/src/config/invidious_video_api.json5
Original file line number Diff line number Diff line change
Expand Up @@ -137,26 +137,16 @@
responseHandler: "PlaylistHandler",
pagination: true,
},
{
name: "mix",
displayName: "Mix",
url: "/api/v1/mixes/{rdid}",
responseHandler: "PlaylistHandler",
},
{
name: "channel",
displayName: "Channel",
url: "/api/v1/channels/videos/{ucid}",
responseHandler: "ChannelHandler",
queryParams: {
sort_by: {
required: false,
type: ["newest", "oldest", "popular"],
},
fields: {
required: false,
type: "string",
default: "title,videoId,videoThumbnails,lengthSeconds,viewCount,author,publishedText,liveNow,isUpcoming,premiereTimestamp",
},
},
},
],
Expand Down

0 comments on commit f328fa2

Please sign in to comment.