Crates.io | wattpad |
lib.rs | wattpad |
version | 0.3.2 |
source | src |
created_at | 2023-03-05 19:22:27.502835 |
updated_at | 2023-09-27 22:39:22.094098 |
description | Unofficial async Rust wrapper around the (various) Wattpad API(s) |
homepage | |
repository | https://github.com/Ruthenic/wattpad-rs |
max_upload_size | |
id | 801674 |
size | 37,501 |
Unofficial async Rust wrapper around the (various) Wattpad API(s)
See docs.rs
Stories:
use wattpad::Wattpad;
#[tokio::main]
async fn main() {
let watt = Wattpad::new()
.await
.unwrap();
let story = watt
.get_story("336149308")
.await
.unwrap();
println!("{}", story.title)
}
Searches:
use wattpad::{SearchSort, SearchType, Wattpad};
#[tokio::main]
async fn main() {
let watt = Wattpad::new()
.await
.unwrap();
// Text searches
let text_search = watt
.search(
"bendy x reader",
SearchType::Text,
SearchSort::Hot,
30,
)
.await
.unwrap();
let text_results = text_search.page(0).await.unwrap();
println!("{}", text_results[0].title)
// Tag searches
let tag_search = watt
.search(
"bendyxreader,batim",
SearchType::Text,
SearchSort::Hot,
30,
)
.await
.unwrap();
let tag_results = tag_search.page(0).await.unwrap();
println!("{}", tag_results[0].title)
}