Struct dlsite::DlsiteClient

source ·
pub struct DlsiteClient { /* private fields */ }
Expand description

API client for DLsite.

Implementations§

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(&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 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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