Add sponsorblock categories and action types as json
This commit is contained in:
1 parent
740440c3a7
commit
1d9dc3ecda
2 files changed
+9
-2
No files matched your search
@@ -1,12 +1,17 @@
|
|||||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||||
|
import "pkg:/source/utils/WebUtils.bs"
|
||||||
|
|
||||||
namespace SponsorBlock
|
namespace SponsorBlock
|
||||||
const API_URL = "https://sponsor.ajay.app"
|
const API_URL = "https://sponsor.ajay.app"
|
||||||
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
|
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
|
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)
|
response = Requests().get(url)
|
||||||
|
|
||||||
if response.statuscode = 200
|
if response.statuscode = 200
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
namespace WebUtils
|
namespace WebUtils
|
||||||
function UrlEncode(url as string) as string
|
function UrlEncode(url as string) as string
|
||||||
ue = m.UrlEncoder
|
ue = m.UrlEncoder
|
||||||
|
|||||||
Reference in new issue
Block a user