0.1.0 |
|
---|
#70 in #anime
195KB
4K
SLoC
crunchyroll-rs
A Rust library for the undocumented Crunchyroll api.
We are in no way affiliated with, maintained, authorized, sponsored, or officially associated with Crunchyroll LLC or any of its subsidiaries or affiliates. The official Crunchyroll website can be found at https://crunchyroll.com/.
Documentation
The documentation is available at docs.rs.
Example
You need this crate and tokio as dependency in your Cargo.toml in order to start working:
[dependencies]
crunchyroll-rs = "0.1"
tokio = { version = "1.21", features = ["full"] }
The following code prints the data of the episode behind the given url:
use crunchyroll::{Crunchyroll, MediaCollection};
use crunchyroll::parse::UrlType;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// log in to crunchyroll with your username and password
let crunchyroll = Crunchyroll::builder()
.login_with_credentials("<username>".into(), "<password>".into())
.await?;
let url = Crunchyroll::parse_url("https://beta.crunchyroll.com/watch/GRDQPM1ZY/alone-and-lonesome")?;
if let UrlType::BetaEpisodeOrMovie(media_id) = url {
match crunchyroll.media_collection_from_id(media_id).await? {
MediaCollection::Episode(episode) => {
println!(
"Url is episode {} ({}) of season {} from {}",
episode.metadata.episode_number,
episode.title,
episode.metadata.season_number,
episode.metadata.series_title
)
}
_ => ()
}
} else {
panic!("Url is not a crunchyroll beta episode")
}
Ok(())
}
More examples can be found in the examples/ directory.
Api Coverage
Crunchyroll regularly updates their beta api but does not provide any documentation for it.
Because we do not monitor the api constantly, so we cannot immediately say when a new endpoint is added or something has changed on already existing and implemented endpoints (which is semi-covered by the __test-strict
feature, at least).
If you find an endpoint which is not implemented or has changes feel free to open a new issue and tell us, or fork the library and implement it yourself.
License
This project is licensed under either of the following licenses, at your option:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
Dependencies
~7–21MB
~292K SLoC