Expand description
A Rust wrapper for the SponsorBlock API.
§Usage
Simply add it to your Cargo.toml as you would any other crate.
§Features
Default features:
-
private_searches: This enables the use of private hash-based segment searching, which significantly improves privacy at a slight bandwidth and performance cost.You should almost certainly leave this on.
-
user: The standard set of user functions.
Optional features:
-
vip: The set of functions for only VIP users. -
gen_user_id: A utility function for generating local user IDs for use with the service.Do not use this every time you start up a client - prefer using a single saved ID for the same ‘user’. This is for cases where you may want to generate new user IDs for users of your application, giving each user their own ID.
§Example
The following is a short example of how you might fetch the segments for a video:
use sponsor_block::{AcceptedCategories, Client};
// This should be random, treated like a password, and stored across sessions
const USER_ID: &str = "your local user id";
let client = Client::new(USER_ID);
let video_segments = client
.fetch_segments("9Yhc6mmdJC4", AcceptedCategories::all())
.await
.ok();
// Then do something with your video segments...Structs§
- Accepted
Categories - A struct for supplying the categories you want to look for in a video.
- Additional
Segment Info - Additional segment information that isn’t always provided by the API, depending on the function.
- ApiStatus
- The results of an API status request.
- Client
- The client for interfacing with SponsorBlock.
- Client
Builder - The builder for the
Client. - Overall
Stats - The overall stats for a user, similar to what
UserInfoprovides. - Segment
- A segment, representing a section or point in time in a video that is worth skipping or otherwise treating specially.
- Time
Point - A singular point in the video, category-agnostic.
- Time
Section - A skippable section, category-agnostic. Contains a start and end time.
- User
Info - The results of a user info request.
- User
Stats - The results of a user info request.
Enums§
- Action
- The action to take on a segment.
- Actionable
Segment - A video segment, containing timestamp information.
- Actionable
Segment Kind - Sponsor
Block Error - The library error type.
Functions§
- gen_
user_ id - A utility function that generates a new local user ID.
Type Aliases§
- Local
User Id - A local/private user ID. This value should be kept private and treated like a password.
- Local
User IdSlice - The ref version of
LocalUserIdfor use in functions. - Public
User Id - A public user ID. This value is a hash of the
LocalUserIdand is used publicly. - Public
User IdSlice - The ref version of
PublicUserIdfor use in functions. - Result
- A convenience type for the return result of service calls.
- Segment
Uuid - A UUID for a segment, uniquely identifying it in the database.
- Segment
Uuid Slice - The ref version of
SegmentUuidfor use in functions. - Status
Code - An HTTP status code number.
- VideoId
- A video ID.
- Video
IdSlice - The ref version of
VideoIdfor use in functions.