Expand description
§YTS Movie API Client
This crate provides an interface for searching and retrieving movie information from the YTS API, including filtering options, pagination, and torrent details.
§Features
- Async and blocking HTTP clients (enabled via feature flags
asyncandblocking). - Rich filtering options such as quality, genre, rating, year, and sorting order.
- Parsing of HTML responses to extract movie and torrent metadata.
§Async Example (default)
use yts::{Filters, OrderBy, Year, Yts};
#[tokio::main]
async fn main() -> yts::Result {
let yts = Yts::default();
let response = yts
.search_with_filter(
"the godfather",
Filters::default()
.year(Year::Range1970to1979)
.order_by(OrderBy::Rating)
.build(),
)
.await?;
println!("{response:#?}");
// Getting the torrents of the first movie
let torrents = yts
.torrents(&response.movies[0])
.await?;
println!("{torrents:#?}");
Ok(())
}§Modules & Re-exports
The crate re-exports key types for convenience:
- Filtering options:
Filters,OrderBy,Quality,Rating,Year - Core types:
Page,Response,Torrent,Genre,Movie - Client structs:
Yts(async) and blocking client (behind feature flags)
§Error Handling
All fallible operations return Result<T> with a custom Error enum that wraps
errors from underlying dependencies (e.g., reqwest, scraper).
§Feature Flags
async— Enables the asynchronous API (search).blocking— Enables the blocking (synchronous) API (blocking::search).
§License
This is free software, published under the MIT License.
§See Also
Structs§
- Filters
- Builder pattern struct for configuring movie filters.
- Movie
- Represents a movie with its basic attributes.
- Page
- Represents pagination information for a movie list page.
- Response
- Represents the response from a movie listing page.
- Torrent
- Represents a torrent download option for a movie.
- Yts
- Client for interacting with the YTS movie API.
Enums§
- Error
- Errors that can occur when using this crate.
- Genre
- Represents the genre of a movie.
- OrderBy
- Represents ordering options for movie queries.
- Quality
- Represents video quality filter options.
- Rating
- Represents rating filter options.
- Year
- Represents year filter options.