invidious
Version:
music player for invidious.io
229 lines (223 loc) • 6.08 kB
JavaScript
const videoThumbnails = [
{
quality: 'String',
url: 'String',
width: 'Number',
height: 'Number'
}
]
const authorThumbnails = [
{
url: 'String',
width: 'Number',
height: 'Number'
}
]
const author = {
author: 'String',
authorId: 'String',
authorUrl: 'String'
}
const video = {
...author,
title: 'String',
videoId: 'String',
videoThumbnails,
description: 'String',
descriptionHtml: 'String',
viewCount: 'Number',
published: 'Number',
publishedText: 'String',
lengthSeconds: 'Number',
paid: 'Boolean',
premium: 'Boolean'
}
export const schema = {
channels: {
// GET /api/v1/channels/:ucid
// Parameters
// | field | value |
// |---------|-------------------------------------------------|
// | sort_by | "newest", "oldest", "popular" (default: newest) |
// Note that a channel's username (if it doesn't include spaces) is also valid in
// place of ucid, e.g. /api/v1/channels/BlenderFoundation.
ucid: {
...author,
authorThumbnails,
authorBanners: [
{
url: 'String',
width: 'Number',
height: 'Number'
}
],
subCount: 'Number',
totalViews: 'Number',
joined: 'Number',
paid: 'Boolean',
autoGenerated: 'Boolean',
isFamilyFriendly: 'Boolean',
description: 'String',
descriptionHtml: 'String',
allowedRegions: 'Array(String)',
latestVideos: [
{ ...video }
],
relatedChannels: [
{
...author,
authorThumbnails
}
]
},
videos: [
// GET /api/v1/channels/:ucid/videos
// GET /api/v1/channels/videos/:ucid
// Parameters
// | field | value |
// |---------|-------------------------------------------------|
// | page | 'Number' |
// | sort_by | "newest", "oldest", "popular" (default: newest) |
{ ...video }
]
},
search: [
// GET /api/v1/search
// Parameters
// | field | value |
// |----------|----------------------------------------------------------|
// | q | 'String' |
// | page | 'Number' |
// | sort_by | "relevance", "rating", "upload_date", "view_count" |
// | date | "hour", "today", "week", "month", "year" |
// | duration | "short", "long" |
// | type | "video", "playlist", "channel", "all", (default: video) |
// | features | "hd", "subtitles", "creative_commons", "3d", "live", |
// | | "purchased", "4k", "360", "location", "hdr" |
// | | (comma separated: e.g. "&features=hd,subtitles,3d,live") |
// | region | ISO 3166 country code (default: "US") |
{
// Case 1
type: 'video',
liveNow: 'Boolean',
...video
},
{
// Case 2
type: 'playlist',
...author,
title: 'String',
playlistId: 'String',
videoCount: 'Number',
videos: [
// TODO expand the playlist videos
{
title: 'String',
videoId: 'String',
lengthSeconds: 'Number',
videoThumbnails
}
]
},
{
// Case 3
// TODO filter channel results out for now
type: 'channel',
...author,
authorThumbnails,
subCount: 'Number',
videoCount: 'Number',
description: 'String',
descriptionHtml: 'String'
}
],
videos: {
// GET /api/v1/videos/:id
// Parameters
// | field | value |
// |--------|---------------------------------------|
// | region | ISO 3166 country code (default: "US") |
video: {
title: 'String',
videoId: 'String',
videoThumbnails,
description: 'String',
descriptionHtml: 'String',
published: 'Int64',
publishedText: 'String',
keywords: 'Array(String)',
viewCount: 'Int64',
likeCount: 'Int32',
dislikeCount: 'Int32',
paid: 'Boolean',
premium: 'Boolean',
isFamilyFriendly: 'Boolean',
allowedRegions: 'Array(String)',
genre: 'String',
genreUrl: 'String',
author: 'String',
authorId: 'String',
authorUrl: 'String',
authorThumbnails,
subCountText: 'String',
lengthSeconds: 'Int32',
allowRatings: 'Boolean',
rating: 'Float32',
isListed: 'Boolean',
liveNow: 'Boolean',
isUpcoming: 'Boolean',
premiereTimestamp: 'Int64?',
hlsUrl: 'String?',
adaptiveFormats: [
{
index: 'String',
bitrate: 'String',
init: 'String',
url: 'String',
itag: 'String',
type: 'String',
clen: 'String',
lmt: 'String',
projectionType: 'Int32',
container: 'String',
encoding: 'String',
qualityLabel: 'String?',
resolution: 'String?'
}
],
formatStreams: [
{
url: 'String',
itag: 'String',
type: 'String',
quality: 'String',
container: 'String',
encoding: 'String',
qualityLabel: 'String',
resolution: 'String',
size: 'String'
}
],
captions: [
{
label: 'String',
languageCode: 'String',
url: 'String'
}
],
// TODO IMPORTANT!
recommendedVideos: [
{
videoId: 'String',
title: 'String',
videoThumbnails,
author: 'String',
lengthSeconds: 'Int32',
viewCountText: 'String'
}
]
}
}
}
console.clear()
console.log(JSON.stringify(schema, 0, 2))