documentation/docs/api.md

576 lines
9.9 KiB
Markdown
Raw Normal View History

# API
2021-01-28 16:04:37 -05:00
### Language
All endpoints that return a JSON body support `&hl=LANGUAGE` for translating fields into the desired language. A list of languages are provided in [List of URL parameters](./url-parameters.md).
2019-03-05 21:19:02 -05:00
##### GET `/api/v1/stats`
> Schema:
2019-06-05 23:41:32 -04:00
```javascript
2019-03-05 21:19:02 -05:00
{
"version": String,
"software": {
"name": "invidious",
"version": String,
"branch": String
},
"openRegistrations": Bool,
"usage": {
"users": {
"total": Int32,
"activeHalfyear": Int32,
"activeMonth": Int32
}
},
"metadata": {
"updatedAt": Int64,
"lastChannelRefreshedAt": Int64
},
"playback": {
"totalRequests": Int32?
"successfulRequests": Int32?
"ratio": Float32?
2019-03-05 21:19:02 -05:00
}
}
```
2018-08-05 13:19:59 -04:00
##### GET `/api/v1/videos/:id`
2018-09-28 11:58:34 -04:00
> Schema:
2019-06-05 23:41:32 -04:00
```javascript
2018-08-05 13:07:48 -04:00
{
"type": String, // "video"|"published"
2018-08-05 13:07:48 -04:00
"title": String,
"videoId": String,
"videoThumbnails": [
2018-09-28 11:58:34 -04:00
{
2018-08-05 13:07:48 -04:00
"quality": String,
"url": String,
"width": Int32,
"height": Int32
}
2018-08-05 13:07:48 -04:00
],
"storyboards": [
{
"url": String,
"templateUrl": String,
"width": Int32,
"height": Int32,
"count": Int32,
"interval ": Int32,
"storyboardWidth": Int32,
"storyboardHeight": Int32,
"storyboardCount": Int32
}
],
2018-08-05 13:07:48 -04:00
"description": String,
"descriptionHtml": String,
2018-09-28 11:48:24 -04:00
"published": Int64,
"publishedText": String,
2018-09-28 11:58:34 -04:00
2018-08-05 13:07:48 -04:00
"keywords": Array(String),
"viewCount": Int64,
"likeCount": Int32,
"dislikeCount": Int32,
2018-09-28 11:58:34 -04:00
2018-11-04 20:00:02 -05:00
"paid": Bool,
"premium": Bool,
2018-08-05 13:07:48 -04:00
"isFamilyFriendly": Bool,
"allowedRegions": Array(String),
"genre": String,
2018-09-28 11:48:24 -04:00
"genreUrl": String,
2018-09-28 11:58:34 -04:00
2018-08-05 13:07:48 -04:00
"author": String,
"authorId": String,
"authorUrl": String,
2018-11-04 20:00:02 -05:00
"authorThumbnails": [
{
"url": String,
"width": Int32,
"height": Int32
}
],
2018-08-05 13:07:48 -04:00
2018-11-04 20:00:02 -05:00
"subCountText": String,
2018-08-05 13:07:48 -04:00
"lengthSeconds": Int32,
"allowRatings": Bool,
"rating": Float32,
2019-03-26 19:02:33 -04:00
"isListed": Bool,
"liveNow": Bool,
"isPostLiveDvr": Bool,
2019-03-26 19:02:33 -04:00
"isUpcoming": Bool,
"dashUrl:" String,
2019-03-26 19:02:33 -04:00
"premiereTimestamp": Int64?,
2018-08-05 13:07:48 -04:00
2019-02-25 10:47:40 -05:00
"hlsUrl": String?,
2018-08-05 13:07:48 -04:00
"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?
}
2018-08-05 13:07:48 -04:00
],
"formatStreams": [
{
"url": String,
"itag": String,
"type": String,
"quality": String,
"container": String,
"encoding": String,
"qualityLabel": String,
"resolution": String,
"size": String
}
2018-08-05 13:07:48 -04:00
],
"captions": [
{
"label": String,
2018-09-28 11:48:24 -04:00
"languageCode": String,
2020-06-10 17:31:37 -04:00
"url": String
}
2018-08-05 13:07:48 -04:00
],
"recommendedVideos": [
{
"videoId": String,
"title": String,
"videoThumbnails": [
{
"quality": String,
"url": String,
"width": Int32,
"height": Int32
}
2018-08-05 13:07:48 -04:00
],
"author": String,
"lengthSeconds": Int32,
2020-06-10 15:02:03 -04:00
"viewCountText": String
2018-08-05 13:07:48 -04:00
}
]
}
```
2019-03-01 11:56:36 -05:00
Parameters:
```
2019-03-01 11:58:19 -05:00
region: ISO 3166 country code (default: "US")
2019-03-01 11:56:36 -05:00
```
2019-03-31 23:44:35 -04:00
##### GET `/api/v1/annotations/:id`
Parameters:
```
source: "archive", "youtube" (default: "archive")
```
Returns annotation XML from YouTube's `/annotations_invideo` endpoint. Alternatively it provides access to legacy annotation data using [this collection](https://archive.org/details/youtubeannotations) on archive.org.
2018-09-28 11:58:34 -04:00
##### GET `/api/v1/comments/:id`
> Schema:
2019-06-05 23:41:32 -04:00
```javascript
2018-09-28 11:58:34 -04:00
{
"commentCount": Int32?,
2019-02-08 20:58:06 -05:00
"videoId": String,
2018-09-28 11:58:34 -04:00
"comments": [
{
"author": String,
"authorThumbnails": [
{
"url": String,
"width": Int32,
"height": Int32
}
2018-09-28 11:58:34 -04:00
],
"authorId": String,
"authorUrl": String,
"isEdited": Boolean,
"isPinned": Boolean,
2018-09-28 11:58:34 -04:00
"content": String,
"contentHtml": String,
"published": Int64,
"publishedText": String,
"likeCount": Int32,
"commentId": String,
2019-02-08 20:58:06 -05:00
"authorIsChannelOwner": Bool,
"creatorHeart": {
"creatorThumbnail": String,
"creatorName": String
}?,
2018-09-28 11:58:34 -04:00
"replies": {
"replyCount": Int32,
"continuation": String
}?
}
],
"continuation": String?
}
```
Parameters:
```
2019-04-05 21:52:14 -04:00
sort_by: "top", "new" (default: top)
source: "youtube", "reddit" (default: youtube)
2018-09-28 11:58:34 -04:00
continuation: String
```
##### GET `/api/v1/captions/:id`
> Schema:
```javascript
{
"captions": [
{
"label": String,
"languageCode": String,
"url": String
}
]
}
```
Parameters:
```
label: String
2018-11-04 20:00:02 -05:00
lang: String
tlang: String
2019-03-01 11:58:19 -05:00
region: ISO 3166 country code (default: "US")
2018-09-28 11:58:34 -04:00
```
A request with `label` will return the selected captions in WebVTT format.
2018-11-04 20:00:02 -05:00
Captions can also be selected with an ISO `lang`, e.g. &lang=en, `tlang` will auto-translate from English into the requested language (if English captions are available).
2018-09-28 11:58:34 -04:00
2018-08-05 13:19:59 -04:00
##### GET `/api/v1/trending`
2018-09-28 11:58:34 -04:00
2018-08-05 13:19:59 -04:00
> Schema:
2018-09-28 11:58:34 -04:00
2019-06-05 23:41:32 -04:00
```javascript
[
2018-08-05 13:30:33 -04:00
{
"title": String,
"videoId": String,
"videoThumbnails": [
{
"quality": String,
"url": String,
"width": Int32,
2020-06-10 17:16:13 -04:00
"height": Int32
}
2018-08-05 13:30:33 -04:00
],
"lengthSeconds": Int32,
"viewCount": Int64,
"author": String,
2018-09-28 11:48:24 -04:00
"authorId": String,
2018-08-05 13:30:33 -04:00
"authorUrl": String,
2018-08-05 13:31:51 -04:00
"published": Int64,
2018-09-28 11:48:24 -04:00
"publishedText": String,
2018-08-05 13:30:33 -04:00
"description": String,
2019-02-25 10:47:40 -05:00
"descriptionHtml": String,
"liveNow": Bool,
"paid": Bool,
"premium": Bool
2018-08-05 13:30:33 -04:00
}
]
2018-08-05 13:19:59 -04:00
```
2018-08-05 13:07:48 -04:00
2019-03-01 11:56:36 -05:00
Parameters:
```
type: "music", "gaming", "movies", "default"
2019-03-01 11:58:19 -05:00
region: ISO 3166 country code (default: "US")
2019-03-01 11:56:36 -05:00
```
2019-06-05 23:40:29 -04:00
##### GET `/api/v1/popular`
> Schema:
```javascript
2019-06-05 23:40:29 -04:00
[
{
"type": "shortVideo",
"title": String,
"videoId": String,
"videoThumbnails": [
{
"quality": String,
"url": String,
"width": Int32,
"height": Int32
2019-06-05 23:40:29 -04:00
}
],
"lengthSeconds": Int32,
2020-06-10 17:43:32 -04:00
"viewCount": Int64,
2019-06-05 23:40:29 -04:00
"author": String,
"authorId": String,
"authorUrl": String,
"published": Int64,
2020-06-10 17:45:41 -04:00
"publishedText": String
2019-06-05 23:40:29 -04:00
}
]
```
2019-07-12 23:27:38 -04:00
##### GET `/api/v1/search/suggestions`
> Schema:
```javascript
{
"query": String,
"suggestions": Array(String)
}
```
Parameters:
```
q: String
```
2018-09-28 11:58:34 -04:00
##### GET `/api/v1/search`
> Schema:
```javascript
2018-08-07 15:45:21 -04:00
[
{
2018-09-28 11:58:34 -04:00
type: "video",
title: String,
videoId: String,
author: String,
authorId: String,
authorUrl: String,
videoThumbnails: [
2018-08-07 15:45:21 -04:00
{
2018-09-28 11:58:34 -04:00
quality: String,
url: String,
width: Int32,
height: Int32
2018-08-07 15:45:21 -04:00
}
],
2018-09-28 11:58:34 -04:00
description: String,
descriptionHtml: String,
viewCount: Int64,
published: Int64,
publishedText: String,
lengthSeconds: Int32,
2018-11-04 20:00:02 -05:00
liveNow: Bool,
paid: Bool,
premium: Bool
2018-09-28 11:48:24 -04:00
},
{
2018-09-28 11:58:34 -04:00
type: "playlist",
title: String,
playlistId: String,
2023-02-05 08:01:30 -05:00
playlistThumbnail: String,
2018-09-28 11:58:34 -04:00
author: String,
authorId: String,
authorUrl: String,
2023-02-05 08:01:30 -05:00
authorVerified: Boolean,
2018-09-28 11:58:34 -04:00
videoCount: Int32,
videos: [
2018-09-28 20:19:15 -04:00
{
2019-03-31 23:44:35 -04:00
title: String,
videoId: String,
lengthSeconds: Int32,
videoThumbnails: [
2018-09-28 20:19:15 -04:00
{
quality: String,
url: String,
width: Int32,
height: Int32
}
]
}
2018-09-28 11:48:24 -04:00
]
},
{
2018-09-28 11:58:34 -04:00
type: "channel",
author: String,
authorId: String,
authorUrl: String,
2018-09-28 11:48:24 -04:00
2018-09-28 11:58:34 -04:00
authorThumbnails: [
2018-09-28 11:48:24 -04:00
{
2018-09-28 11:58:34 -04:00
url: String,
width: Int32,
height: Int32
2018-09-28 11:48:24 -04:00
}
],
2023-02-05 08:01:30 -05:00
autoGenerated: Bool
2018-09-28 11:58:34 -04:00
subCount: Int32,
videoCount: Int32,
description: String,
descriptionHtml: String
2018-08-07 15:45:21 -04:00
}
2018-09-28 11:58:34 -04:00
];
2018-08-05 13:36:55 -04:00
```
2018-08-07 15:57:58 -04:00
2018-09-28 11:58:34 -04:00
Parameters:
2018-08-08 11:36:46 -04:00
```
2018-09-28 11:58:34 -04:00
q: String
page: Int32
sort: "relevance", "rating", "date", "views"
2018-08-08 11:36:46 -04:00
date: "hour", "today", "week", "month", "year"
2023-02-05 08:01:30 -05:00
duration: "short", "long", "medium"
type: "video", "playlist", "channel", "movie", "show", "all", (default: all)
features: "hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr", "vr180" (comma separated: e.g. "&features=hd,subtitles,3d,live")
2019-03-01 11:58:19 -05:00
region: ISO 3166 country code (default: "US")
2018-08-08 11:36:46 -04:00
```
2018-09-28 11:58:34 -04:00
##### GET `/api/v1/playlists/:plid`
2018-08-07 15:57:58 -04:00
> Schema:
2018-09-28 11:58:34 -04:00
```javascript
{
"title": String,
"playlistId": String,
2018-08-08 11:36:46 -04:00
2018-09-28 11:58:34 -04:00
"author": String,
"authorId": String,
"authorThumbnails": [
{
"url": String,
"width": String,
"height": String
}
],
"description": String,
"descriptionHtml": String,
2018-08-08 11:36:46 -04:00
2018-09-28 11:58:34 -04:00
"videoCount": Int32,
"viewCount": Int64,
"updated": Int64,
2018-08-08 11:36:46 -04:00
2018-09-28 11:58:34 -04:00
"videos": [
2018-09-28 20:19:15 -04:00
{
"title": String,
"videoId": String,
"author": String,
"authorId": String,
"authorUrl": String,
2019-03-31 23:44:35 -04:00
2018-09-28 20:19:15 -04:00
"videoThumbnails": [
{
"quality": String,
"url": String,
"width": Int32,
"height": Int32
}
],
"index": Int32,
"lengthSeconds": Int32
}
2018-09-28 11:58:34 -04:00
]
2018-08-07 15:57:58 -04:00
}
2018-08-08 11:36:46 -04:00
```
Parameters:
2018-09-28 11:58:34 -04:00
```
page: Int32
2018-08-08 11:36:46 -04:00
```
2018-11-04 20:00:02 -05:00
##### GET `/api/v1/mixes/:rdid`
> Schema:
```javascript
{
title: String,
mixId: String,
videos: [
{
title: String,
videoId: String,
author: String,
authorId: String,
authorUrl: String,
videoThumbnails: [
{
quality: String,
url: String,
width: Int32,
height: Int32
}
],
index: Int32,
lengthSeconds: Int32
}
]
}
```
##### GET `/api/v1/hashtag/:tag`
> Schema:
```javascript
{
results: VideoObject[],
}
```
Parameters:
```
page: Int32
```
##### GET `/api/v1/resolveurl`
> Schema:
```javascript
{
ucid?: String,
videoId?: String,
playlistId?: String,
startTimeSeconds?: String,
params?: String,
pageType: string
}
```
Parameters:
```
url: URL
```
##### GET `/api/v1/clips`
> Schema:
```javascript
{
startTime: Float64, // in seconds
endTime: Float64, // in seconds
clipTitle: String,
video: VideoObject
}
```
Parameters:
```
id: string
```