Add sponsorblock categories and action types as json

This commit is contained in:
Brahim Hadriche committed 2022-11-23 21:14:09 -05:00
1 parent 740440c3a7
commit 1d9dc3ecda
3 files changed
+11 -4

No files matched your search

+2 -2
View File
@@ -100,7 +100,7 @@ function ScrollUp() as void
destination = m.scrollAnimationInterpolator.keyValue[0][1]
current = m.container.translation[1]
if current = destination
return
return
end if
m.scrollAnimationInterpolator.reverse = true
m.scrollAnimation.control = "start"
@@ -110,7 +110,7 @@ function ScrollDown() as void
destination = m.scrollAnimationInterpolator.keyValue[2][1]
current = m.container.translation[1]
if current = destination
return
return
end if
m.scrollAnimationInterpolator.reverse = false
m.scrollAnimation.control = "start"
+7 -2
View File
@@ -1,12 +1,17 @@
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
import "pkg:/source/utils/WebUtils.bs"
namespace SponsorBlock
const API_URL = "https://sponsor.ajay.app"
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
const CATEGORIES = "&category=sponsor&category=selfpromo&category=interaction&category=intro&category=outro&category=preview&category=music_offtopic"
function GetSkipSegmentsForVideo(videoId as string) as object
url = `${SponsorBlock.API_URL}${SponsorBlock.SKIP_SEGMENT_ENDPOINT}?videoID=${videoId}${SponsorBlock.CATEGORIES}`
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "chapter", "filler", "exclusive_access"]
actionTypes = ["skip", "mute", "chapter", "full", "poi"]
categoriesJson = WebUtils.UrlEscape(FormatJson(categories))
actionTypesJson = WebUtils.UrlEscape(FormatJson(actionTypes))
url = `${SponsorBlock.API_URL}${SponsorBlock.SKIP_SEGMENT_ENDPOINT}?videoID=${videoId}&categories=${categoriesJson}&actionTypes=${actionTypesJson}`
response = Requests().get(url)
if response.statuscode = 200
+2
View File
@@ -1,3 +1,5 @@
import "pkg:/source/utils/Types.bs"
namespace WebUtils
function UrlEncode(url as string) as string
ue = m.UrlEncoder