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