pub struct DlsiteClient { /* private fields */ }
Expand description
API client for DLsite.
Implementations§
Source§impl DlsiteClient
impl DlsiteClient
pub async fn get_circle( &self, circle_id: &str, options: &CircleQueryOptions, ) -> Result<SearchResult, DlsiteError>
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn get_products_ajax(
&self,
product_ids: Vec<&str>,
) -> Result<HashMap<String, ProductAjax>, DlsiteError>
pub async fn get_products_ajax( &self, product_ids: Vec<&str>, ) -> Result<HashMap<String, ProductAjax>, DlsiteError>
Get the AJAX data of multiple products.
Sourcepub async fn get_product_ajax(
&self,
product_id: &str,
) -> Result<ProductAjax, DlsiteError>
pub async fn get_product_ajax( &self, product_id: &str, ) -> Result<ProductAjax, DlsiteError>
Get the AJAX data of a product.
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn get_product_html(
&self,
product_id: &str,
) -> Result<ProductHtml, DlsiteError>
pub async fn get_product_html( &self, product_id: &str, ) -> Result<ProductHtml, DlsiteError>
Get and parse the HTML page of a product.
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn get_product_review(
&self,
product_id: &str,
limit: u32,
page: u32,
mix_pickup: bool,
order: ReviewSortOrder,
) -> Result<ProductReview, DlsiteError>
pub async fn get_product_review( &self, product_id: &str, limit: u32, page: u32, mix_pickup: bool, order: ReviewSortOrder, ) -> Result<ProductReview, DlsiteError>
Get product reviews and related informations.
§Arguments
product_id
- Product ID.mix_pickup
- Mixes picked up review. To get user genre, this must be true.order
- Sort order of reviews.limit
- Number of reviews to get.page
- Page number.
§Returns
ProductReview
- Product reviews and related informations.
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn get_product(
&self,
product_id: &str,
) -> Result<Product, DlsiteError>
pub async fn get_product( &self, product_id: &str, ) -> Result<Product, DlsiteError>
Get information about a product (also called “work”). This function will make 3 requests to DLsite: one to get the HTML page, one to get the AJAX data and one to get the review data. Especially, review data can be used as independent information.
§Arguments
product_id
- The product ID to get information about. Example:RJ123456
. NOTE: This must be capitalized.
§Example
use dlsite::{DlsiteClient, product::Product};
use tokio;
#[tokio::main]
async fn main() {
let client = DlsiteClient::default();
let product = client.get_product("RJ123456").await.unwrap();
println!("{:#?}", product);
}
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn get_product_api(
&self,
id: &str,
) -> Result<ProductApiContent, DlsiteError>
pub async fn get_product_api( &self, id: &str, ) -> Result<ProductApiContent, DlsiteError>
Get product detail using api.
§Arguments
id
- Product ID.
§Returns
ProductApiContent
- Product details.
§Note
This api does not return dl count.
And because of confusing specification of api, serde::Value is used in some place.
Instead of this you also can use DlsiteClient.get_product
which scrapes html.
§Example
use dlsite::{DlsiteClient, product::Product};
use tokio;
#[tokio::main]
async fn main() {
let client = DlsiteClient::default();
let product = client.get_product_api("RJ01014447").await.unwrap();
assert_eq!(product.creators.unwrap().voice_by.unwrap()[0].name, "佐倉綾音");
}
Source§impl DlsiteClient
impl DlsiteClient
Sourcepub async fn search_product(
&self,
options: &ProductSearchOptions,
) -> Result<SearchResult, DlsiteError>
pub async fn search_product( &self, options: &ProductSearchOptions, ) -> Result<SearchResult, DlsiteError>
Search products on DLsite.
§Arguments
options
- Struct of search options.
§Example
use dlsite::{DlsiteClient, product::Product, search::options::*};
use tokio;
#[tokio::main]
async fn main() {
let client = DlsiteClient::default();
let product = client
.search_product(&ProductSearchOptions {
sex_category: Some(vec![SexCategory::Male]),
keyword: Some("ASMR".to_string()),
..Default::default()
})
.await
.expect("Failed to search");
dbg!(&product);
}
Source§impl DlsiteClient
impl DlsiteClient
Trait Implementations§
Source§impl Clone for DlsiteClient
impl Clone for DlsiteClient
Source§fn clone(&self) -> DlsiteClient
fn clone(&self) -> DlsiteClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DlsiteClient
impl Debug for DlsiteClient
Source§impl Default for DlsiteClient
impl Default for DlsiteClient
Source§fn default() -> DlsiteClient
fn default() -> DlsiteClient
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DlsiteClient
impl !RefUnwindSafe for DlsiteClient
impl Send for DlsiteClient
impl Sync for DlsiteClient
impl Unpin for DlsiteClient
impl !UnwindSafe for DlsiteClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more