Struct DlsiteClient

Source
pub struct DlsiteClient { /* private fields */ }
Expand description

API client for DLsite.

Implementations§

Source§

impl DlsiteClient

Source

pub async fn get_circle( &self, circle_id: &str, options: &CircleQueryOptions, ) -> Result<SearchResult, DlsiteError>

Source§

impl DlsiteClient

Source

pub async fn get_products_ajax( &self, product_ids: Vec<&str>, ) -> Result<HashMap<String, ProductAjax>, DlsiteError>

Get the AJAX data of multiple products.

Source

pub async fn get_product_ajax( &self, product_id: &str, ) -> Result<ProductAjax, DlsiteError>

Get the AJAX data of a product.

Source§

impl DlsiteClient

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub async fn get(&self, path: &str) -> Result<String, DlsiteError>

Source

pub async fn get_raw(&self, url: &str) -> Result<String, DlsiteError>

Trait Implementations§

Source§

impl Clone for DlsiteClient

Source§

fn clone(&self) -> DlsiteClient

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DlsiteClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DlsiteClient

Source§

fn default() -> DlsiteClient

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T