Add playlist support
This commit is contained in:
1 parent
6a4478f916
commit
7c24f36149
4 files changed
+42
-2
No files matched your search
+3
-2
@@ -10,9 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Web server allowing the recption of the token through call back
|
||||
- The web server can also be used to serve a web app, facilitating the
|
||||
configuration of the Roku app, as well as controlling the app itself
|
||||
- Added `auth/feed`, to read the subscriptions of the current user
|
||||
- `auth/feed`, to read the subscriptions of the current user
|
||||
- Video information (Author, view count, release date)
|
||||
- Added trending categories, subscription view, and custom (hardcoded) search categories
|
||||
- Trending categories, subscription view, and custom (hardcoded) search categories
|
||||
- User Playlist support
|
||||
|
||||
## [0.1.0] - 2022-10-30
|
||||
### Added
|
||||
|
||||
@@ -18,6 +18,9 @@ sub OnContentSet()
|
||||
end sub
|
||||
|
||||
function FormatViewCount(viewCount)
|
||||
if viewCount = invalid
|
||||
return invalid
|
||||
end if
|
||||
if viewCount < 1000
|
||||
return `${FormatFloat(viewCount)} views`
|
||||
end if
|
||||
|
||||
@@ -40,6 +40,17 @@ sub GetContent()
|
||||
end if
|
||||
end for
|
||||
|
||||
playlists = RokuYoutube.Services.Invidious.GetUserPlaylists()
|
||||
if playlists <> invalid
|
||||
for each playlist in playlists
|
||||
data = GetCategoryContent(`Playlist - ${playlist.title}`, playlist.videos)
|
||||
if data <> invalid
|
||||
rootChildren.Push(data)
|
||||
end if
|
||||
|
||||
end for
|
||||
end if
|
||||
|
||||
' set up a root ContentNode to represent rowList on the GridScreen
|
||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||
contentNode.Update({
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace RokuYoutube.Services.Invidious
|
||||
const SEARCH_ENDPOINT = "/api/v1/search"
|
||||
|
||||
const AUTH_FEED = "/api/v1/auth/feed"
|
||||
const AUTH_PLAYLISTS = "/api/v1/auth/playlists"
|
||||
|
||||
function GetCountryCode()
|
||||
if m.countryCode = invalid or m.countryCode = "" then
|
||||
@@ -165,4 +166,28 @@ namespace RokuYoutube.Services.Invidious
|
||||
return response.json.videos
|
||||
end if
|
||||
end function
|
||||
|
||||
function GetUserPlaylists()
|
||||
headers = GetAuthenticationHeaders()
|
||||
if headers = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
url = `${API_URL}${AUTH_PLAYLISTS}`
|
||||
|
||||
args = {
|
||||
headers: headers,
|
||||
retryCount: 3 'Sometimes authentication fails randomly with a valid token...
|
||||
}
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 403
|
||||
RokuYoutube.Utils.Registry.Delete("token")
|
||||
end if
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
end if
|
||||
|
||||
end function
|
||||
end namespace
|
||||
Reference in new issue
Block a user