API Docs: Difference between revisions

Jump to navigation Jump to search
314 bytes added ,  24 October 2021
Merge changes from drafts
(update from Draft)
(Merge changes from drafts)
Line 29: Line 29:
   videoID: string,
   videoID: string,
    
    
   category: string, // Optional, defaults to "sponsor", can be repeated for multiple categories.
   category: string, // Optional, defaults to "sponsor", can be repeated for multiple categories. [1]
   // OR
   // OR
   categories: string[], // Optional, array of categories, will look like ["sponsor","intro"]
   categories: string[], // Optional [1]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category


   requiredSegment: string, // Segment UUID to require to be retrieved, even if they don't meet the minimum vote threshold. Can be repeated for multiple segments.
   requiredSegment: string, // Segment UUID to require to be retrieved, even if they don't meet the minimum vote threshold. Can be repeated for multiple segments.
Line 38: Line 37:
   requiredSegments: string[], // Optional, array of required segment UUIDs
   requiredSegments: string[], // Optional, array of required segment UUIDs


   actionType: string // Optional, default skip. Can be repeated for multiple types. Options are skip, mute
   actionType: string // Optional, default skip. Can be repeated for multiple types. [3]
   // OR   
   // OR   
   actionTypes: string[] // Optional, array of action types
   actionTypes: string[] // Optional, array of action types


   service: string // Optional, default is 'YouTube'
   service: string, // Optional, default is 'YouTube' [2]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#service
  locked: int, // If segment is locked
  votes: int, // Votes on segment
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0">See [https://github.com/ajayyy/SponsorBlock/wiki/Types#category Github Wiki] for full list of possible categories. To get multiple, create an array with the format <code>["sponsor", intro"]</code>. </ref> <ref name=":1">Service to get segments for. See [https://github.com/ajayyy/SponsorBlock/wiki/Types#service Github Wiki] for supported services</ref> <ref name=":2">Action Types: Possible values are "mute" and "skip" Select multiple with the format <code>["skip","mute]</code></ref>


'''Response''':
'''Response''':
Line 73: Line 75:
   prefix: string, // Can be used instead of path
   prefix: string, // Can be used instead of path


   category: string, // Optional, defaults to "sponsor", can be repeated for multiple categories.
   category: string, // Optional, defaults to "sponsor", can be repeated for multiple categories. [1]
   // OR
   // OR
   categories: string[], // Optional, array of categories, will look like ["sponsor","intro"]
   categories: string[], // Optional, array of categories [1]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category


   requiredSegment: string, // Segment UUID to require to be retrieved, even if they don't meet the minimum vote threshold. Can be repeated for multiple segments.
   requiredSegment: string, // Segment UUID to require to be retrieved, even if they don't meet the minimum vote threshold. Can be repeated for multiple segments.
Line 82: Line 83:
   requiredSegments: string[], // Optional, array of required segment UUIDs
   requiredSegments: string[], // Optional, array of required segment UUIDs


   actionType: string // Optional, default skip. Can be repeated for multiple types. Options are skip, mute
   actionType: string // Optional, default skip. Can be repeated for multiple types. [3]
   // OR   
   // OR   
   actionTypes: string[] // Optional, array of action types  
   actionTypes: string[] // Optional, array of action types [3]


   service: string // Optional, default is 'YouTube'.
   service: string // Optional, default is 'YouTube'. [2]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#service
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":1" /> <ref name=":2" />


'''Response'''
'''Response'''
Line 118: Line 120:
   startTime: float,
   startTime: float,
   endTime: float,
   endTime: float,
   category: string,
   category: string, // [1]
   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)
   userAgent: string, // "Name of Client/Version" or "[BOT] Name of Bot/Version" ex. "Chromium/1.0.0"
   userAgent: string, // "Name of Client/Version" or "[BOT] Name of Bot/Version" ex. "Chromium/1.0.0"
   service: string, // Optional, default is 'YouTube'.
   service: string, // Optional, default is 'YouTube'. [2]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#service
   videoDuration: float, // Optional, duration of video, will attempt to retrieve from the YouTube API if missing (to be used to determine when a submission is out of date)
   videoDuration: float, // Optional, duration of video, will attempt to retrieve from the YouTube API if missing (to be used to determine when a submission is out of date)
   actionType: string // Optional, default is "skip". can also be "mute"
   actionType: string // Optional, default is "skip". [3]
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":1" /> <ref name=":2" />


'''OR'''
'''OR'''
Line 136: Line 139:
   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)
   userAgent: string, // "Name of Client/Version" or "[BOT] Name of Bot/Version" ex. "Chromium/1.0.0"
   userAgent: string, // "Name of Client/Version" or "[BOT] Name of Bot/Version" ex. "Chromium/1.0.0"
   service: string, // Optional, default is 'YouTube'.
   service: string, // Optional, default is 'YouTube'.[2]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#service
   videoDuration: float, // Optional, duration of video, will attempt to retrieve from the YouTube API if missing (to be used to determine when a submission is out of date)
   videoDuration: float, // Optional, duration of video, will attempt to retrieve from the YouTube API if missing (to be used to determine when a submission is out of date)


   segments: [{ // Array of this object
   segments: [{ // 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
     category: string,
     category: string, // [1]
     actionType: string // Optional, defaults to "skip", can also be "mute"
     actionType: string // Optional, defaults to "skip". [3]
   }]
   }]
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":1" /> <ref name=":2" />


'''Response''':
'''Response''':
Line 195: Line 199:
   UUID: string, // UUID of the segment being voted on
   UUID: string, // UUID of the segment being voted on
   userID: string, // Local userID
   userID: string, // Local userID
   category: string // Category to change this submission to
   category: string // Category to change this submission to [1]
} </syntaxhighlight>
} </syntaxhighlight>
References: <ref name=":0" />


'''Response''':
'''Response''':
Line 441: Line 447:
   timeSubmitted: int,
   timeSubmitted: int,
   views: int, // Number of reported views on the segment
   views: int, // Number of reported views on the segment
   category: string, // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
   category: string, // [1]
   service: string, // See https://github.com/ajayyy/SponsorBlock/wiki/Types#service
   service: string, // [2]
   videoDuration: int,
   videoDuration: int,
   hidden: int, // If the segment has 2 downvotes or was downvoted by a VIP
   hidden: int, // If the segment has 2 downvotes or was downvoted by a VIP
   reputation: int, // Reputation of submitter at time of submission
   reputation: int, // Reputation of submitter at time of submission
   shadowHidden: int, // If the submitter is shadowbanned
   shadowHidden: int, // If the submitter is shadowbanned
   userAgent: string // userAgent of the submitter
   userAgent: string // userAgent of the submitter,
  actionType: string // [3]
}]
}]
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":1" /> <ref name=":2" />


'''Error codes''':
'''Error codes''':
Line 497: Line 506:
<syntaxhighlight lang="ts">
<syntaxhighlight lang="ts">
{
{
   categories: string[],
   categories: string[], // [1]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
   reason: string // Specified reason for the lock
   reason: string // Specified reason for the lock
     // Only the most recent reason will be returned
     // Only the most recent reason will be returned
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" />


'''Error codes''':
'''Error codes''':
Line 527: Line 537:
   videoID: string,
   videoID: string,
   hash: string, // The full hash of the videoID
   hash: string, // The full hash of the videoID
   categories": string[],
   categories": string[], // [1]
  // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
   reason: string // Specified reason for the lock
   reason: string // Specified reason for the lock
}]
}]
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" />


'''Error codes''':
'''Error codes''':
Line 547: Line 558:
   videoID: string
   videoID: string
    
    
   // Categories to get reasons for, defaults to all
   // Categories to get reasons for, defaults to all [1]
   category: string
   category: string
   // OR
   // OR
Line 553: Line 564:
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" />


'''Response''':
'''Response''':
Line 576: Line 589:
   videoID: string
   videoID: string


   category: string
   category: string // [1]
   // OR
   // OR
   categories: string[]
   categories: string[]


   actionType: string
   actionType: string // [3]
   // OR
   // OR
   actionTypes: string[]
   actionTypes: string[]
    
    
   service: string
   service: string // [2]
   // End SkipSegments
   // End SkipSegments


Line 602: Line 615:
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":1" /> <ref name=":2" />


'''Response''':
'''Response''':
Line 614: Line 629:
     startTime: int,
     startTime: int,
     endTime: int,
     endTime: int,
     category: int,
     category: int, // [1]
     actionType: int,
     actionType: int, // [3]
     votes: int,
     votes: int,
     views: int,
     views: int,
Line 624: Line 639:
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" /> <ref name=":2" />


'''Error codes''':
'''Error codes''':
Line 630: Line 647:


404: Not Found
404: Not Found
-----
-----
====='''GET''' <code>/api/status/:value</code>=====
====='''GET''' <code>/api/status/:value</code>=====
Line 761: Line 779:
   videoID: string,
   videoID: string,
   userID: string, // Local userID
   userID: string, // Local userID
   categories: string[], // Categories to lock
   categories: string[], // [1]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
   reason: string // Reason for lock
   reason: string // Reason for lock
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" />


'''Response''':
'''Response''':
Line 788: Line 807:
   videoID: string,
   videoID: string,
   userID: string, // Local userID
   userID: string, // Local userID
   categories: string[] // Categories to remove locks for
   categories: string[] // [1]
    // See https://github.com/ajayyy/SponsorBlock/wiki/Types#category
}
}
</syntaxhighlight>
</syntaxhighlight>
References: <ref name=":0" />


'''Response''':
'''Response''':
Line 971: Line 991:
===Local userID vs Public userID===
===Local userID vs Public userID===
The local userID should be a randomly generated and saved client side and must be 32 characters (or more). If it is not 32 characters or more, you will not be able to vote or submit. The public userID is what is used as an identifier in the database. This is the local userID with a SHA 256 hash 5000 times.
The local userID should be a randomly generated and saved client side and must be 32 characters (or more). If it is not 32 characters or more, you will not be able to vote or submit. The public userID is what is used as an identifier in the database. This is the local userID with a SHA 256 hash 5000 times.
=== References ===
<references />

Navigation menu