diff options
author | Max Baumann <[email protected]> | 2020-12-15 13:33:38 +0100 |
---|---|---|
committer | Max Baumann <[email protected]> | 2020-12-15 13:33:38 +0100 |
commit | b7ea5689c75fdb6aca0867c74e8687d08a8f62b1 (patch) | |
tree | 9c5f6db3ed633c31adf4d8bb651913e1ba31c33f /src | |
parent | 7756a89960b88a61a3df49ef55a45d4dc55131dd (diff) | |
download | SponsorBlock-b7ea5689c75fdb6aca0867c74e8687d08a8f62b1.tar.gz SponsorBlock-b7ea5689c75fdb6aca0867c74e8687d08a8f62b1.zip |
refactor(types): add VideoInfo interface
Diffstat (limited to 'src')
-rw-r--r-- | src/content.ts | 4 | ||||
-rw-r--r-- | src/types.ts | 79 |
2 files changed, 80 insertions, 3 deletions
diff --git a/src/content.ts b/src/content.ts index 18b7a646..f176980a 100644 --- a/src/content.ts +++ b/src/content.ts @@ -1,6 +1,6 @@ import Config from "./config"; -import { SponsorTime, CategorySkipOption, VideoID, SponsorHideType, FetchResponse } from "./types"; +import { SponsorTime, CategorySkipOption, VideoID, SponsorHideType, FetchResponse, VideoInfo } from "./types"; import { ContentContainer } from "./types"; import Utils from "./utils"; @@ -25,7 +25,7 @@ let sponsorTimes: SponsorTime[] = null; let sponsorVideoID: VideoID = null; // JSON video info -let videoInfo: any = null; +let videoInfo: VideoInfo = null; //the channel this video is about let channelID; diff --git a/src/types.ts b/src/types.ts index d7818e01..423adf1e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -78,6 +78,82 @@ interface BackgroundScriptContainer { unregisterFirefoxContentScript: (id: string) => void } +interface VideoInfo { + responseContext: { + serviceTrackingParams: Array<{service: string, params: Array<{key: string, value: string}>}>, + webResponseContextExtensionData: { + hasDecorated: boolean + } + }, + playabilityStatus: { + status: string, + playableInEmbed: boolean, + miniplayer: { + miniplayerRenderer: { + playbackMode: string + } + } + }; + streamingData: unknown; + playbackTracking: unknown; + videoDetails: { + videoId: string, + title: string, + lengthSeconds: string, + keywords: string[], + channelId: string, + isOwnerViewing: boolean, + shortDescription: string, + isCrawlable: boolean, + thumbnail: { + thumbnails: Array<{url: string, width: number, height: number}> + }, + averageRating: number, + allowRatings: boolean, + viewCount: string, + author: string, + isPrivate: boolean, + isUnpluggedCorpus: boolean, + isLiveContent: boolean, + }; + playerConfig: unknown; + storyboards: unknown; + microformat: { + playerMicroformatRenderer: { + thumbnail: { + thumbnails: Array<{url: string, width: number, height: number}> + }, + embed: { + iframeUrl: string, + flashUrl: string, + width: number, + height: number, + flashSecureUrl: string, + }, + title: { + simpleText: string, + }, + description: { + simpleText: string, + }, + lengthSeconds: string, + ownerProfileUrl: string, + externalChannelId: string, + availableCountries: string[], + isUnlisted: boolean, + hasYpcMetadata: boolean, + viewCount: string, + category: string, + publishDate: string, + ownerChannelName: string, + uploadDate: string, + } + }; + trackingParams: string; + attestation: unknown; + messages: unknown; +} + type VideoID = string; export { @@ -91,5 +167,6 @@ export { SponsorHideType, PreviewBarOption, Registration, - BackgroundScriptContainer + BackgroundScriptContainer, + VideoInfo, }; |