mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 23:47:04 +03:00
Updated API Docs (markdown)
72
API-Docs.md
72
API-Docs.md
@@ -20,7 +20,7 @@ ________________________________________________________________________________
|
||||
**GET** `/api/skipSegments`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
videoID: string,
|
||||
category: string, // Optional, defaults to "sponsor". See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
|
||||
@@ -32,7 +32,7 @@ ________________________________________________________________________________
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
[{ // Array of this object
|
||||
segment: float[], //[0, 15.23] start and end time in seconds
|
||||
UUID: string,
|
||||
@@ -50,7 +50,7 @@ __________________________________________________________________
|
||||
**POST** `/api/skipSegments`
|
||||
|
||||
**Input Option 1 (URL Parameters)**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
videoID: string,
|
||||
startTime: float,
|
||||
@@ -64,7 +64,7 @@ __________________________________________________________________
|
||||
```
|
||||
|
||||
**Input Option 2 (JSON Body)**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
videoID: string,
|
||||
userID: string, // This should be a randomly generated UUID stored locally (not the public one)
|
||||
@@ -78,7 +78,7 @@ __________________________________________________________________
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -101,7 +101,7 @@ ________________________________________________________________________________
|
||||
`sha256HashPrefix` is a hash of the YouTube `videoID`. It should be the first 3 - 32 characters (4 is recommended, server caching may be implemented only for 4). This provides extra privacy by potentially finding more than just the video you are looking for. This makes the server not know exactly what video you are looking for.
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
category: string, // Optional, defaults to "sponsor". See [the category list](https://raw.githubusercontent.com/ajayyy/SponsorBlock/master/config.json.example)
|
||||
|
||||
@@ -113,7 +113,7 @@ ________________________________________________________________________________
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
[{ // Array of this object
|
||||
"videoID": string,
|
||||
"hash": string, // The full hash
|
||||
@@ -134,7 +134,7 @@ __________________________________________________________________
|
||||
**POST** <sup>or **GET** (legacy)</sup> `/api/voteOnSponsorTime`
|
||||
|
||||
**Input: Normal Vote** (URL Parameters):
|
||||
```
|
||||
```js
|
||||
{
|
||||
UUID: string, //id of the sponsor being voted on
|
||||
userID: string, //the local user id
|
||||
@@ -145,7 +145,7 @@ __________________________________________________________________
|
||||
OR
|
||||
|
||||
**Input: Category Vote** (URL Parameters):
|
||||
```
|
||||
```js
|
||||
{
|
||||
UUID: string, //id of the sponsor being voted on
|
||||
userID: string, //the local user id
|
||||
@@ -154,7 +154,7 @@ OR
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -171,14 +171,14 @@ __________________________________________________________________
|
||||
**POST** <sup>or **GET** (legacy)</sup> `/api/viewedVideoSponsorTime`
|
||||
|
||||
**Input** (URL Parameters):
|
||||
```
|
||||
```js
|
||||
{
|
||||
UUID: string
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -193,14 +193,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getViewsForUser`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string //the local user id
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
viewCount: int
|
||||
}
|
||||
@@ -215,14 +215,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getSavedTimeForUser`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string //the local user id
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
timeSaved: float //in minutes
|
||||
}
|
||||
@@ -237,7 +237,7 @@ __________________________________________________________________
|
||||
**POST** `/api/setUsername`
|
||||
|
||||
**Input** (URL Parameters):
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string, //local user id normally, public user id if adminUserID is specified
|
||||
username: string,
|
||||
@@ -247,7 +247,7 @@ __________________________________________________________________
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -262,14 +262,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getUsername`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string //the local user id
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userName: string //will send back hashed userID if no username has been set
|
||||
}
|
||||
@@ -286,14 +286,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getTopUsers`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
sortType: int //0 for by minutes saved, 1 for by view count, 2 for by total submissions
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userNames: array [string],
|
||||
viewCounts: array [int],
|
||||
@@ -311,14 +311,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getTotalStats`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
"countContributingUsers": boolean //Optional, default false
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userCount: int, // Only if countContributingUsers was true
|
||||
activeUsers: int, // Sum of public install stats from Chrome webstore and Firefox addons store
|
||||
@@ -337,14 +337,14 @@ __________________________________________________________________
|
||||
**GET** `/api/getDaysSavedFormatted`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
daysSaved: float (2 decimal places)
|
||||
}
|
||||
@@ -362,14 +362,14 @@ These can only be called by the users added to the VIP table.
|
||||
**GET** `/api/isUserVIP`
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string, // private userID
|
||||
}
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
hashedUserID: string,
|
||||
vip: boolean
|
||||
@@ -387,7 +387,7 @@ __________________________________________________________________
|
||||
Will block new segment submissions of the specified category on that video.
|
||||
|
||||
**Input** (Request Body):
|
||||
```
|
||||
```js
|
||||
{
|
||||
videoID: string,
|
||||
userID: string,
|
||||
@@ -396,7 +396,7 @@ Will block new segment submissions of the specified category on that video.
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -415,7 +415,7 @@ __________________________________________________________________
|
||||
Shadow banned submissions are hidden for everyone but the IP that originally submitted it. Shadow banning a user shadow bans all future submissions.
|
||||
|
||||
**Input** (URL Parameters):
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string, //public userID of the user you want to shadowBan
|
||||
adminUserID: string, //your userID as an admin
|
||||
@@ -425,7 +425,7 @@ Shadow banned submissions are hidden for everyone but the IP that originally sub
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -443,7 +443,7 @@ __________________________________________________________________
|
||||
Temporary ban that shows a warning asking them to contact us.
|
||||
|
||||
**Input** (Request Body):
|
||||
```
|
||||
```js
|
||||
{
|
||||
issuerUserID: string, // your userID
|
||||
userID: string, // public userID you are warning
|
||||
@@ -452,7 +452,7 @@ Temporary ban that shows a warning asking them to contact us.
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
@@ -473,7 +473,7 @@ These can only be called by the server administrator, set in the config.
|
||||
VIPs have extra privileges and their votes count more.
|
||||
|
||||
**Input**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
userID: string, //public userID of the user you want to add to the VIP list
|
||||
adminUserID: string, //your userID as an admin
|
||||
@@ -482,7 +482,7 @@ VIPs have extra privileges and their votes count more.
|
||||
```
|
||||
|
||||
**Response**:
|
||||
```
|
||||
```js
|
||||
{
|
||||
Nothing (status code 200)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user