Reference

dlsite_async

DLsite Async.

class dlsite_async.AgeCategory(*values)

Work age rating.

class dlsite_async.BookType(*values)

Book type.

class dlsite_async.Circle(maker_id, maker_name)

DLsite circle (maker) class.

Parameters:
  • maker_id (str)

  • maker_name (str)

classmethod from_dict(d)

Construct Circle from a dictionary.

Parameters:

d (Mapping[str, Any])

Return type:

Circle

property maker_type: MakerType

Return maker type for this circle.

class dlsite_async.DlsiteAPI(locale=None, **kwargs)

DLsite API session.

Parameters:
  • locale (str | None) – Optional locale. Defaults to ja_JP.

  • kwargs (Any)

get(*args, **kwargs)

Perform get request.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

_BaseRequestContextManager[ClientResponse]

async get_circle(maker_id)

Return the specified circle.

Parameters:

maker_id (str) – DLsite maker ID.

Returns:

Circle information.

Raises:

DlsiteError – Failed to fetch circle information.

Return type:

Circle

async get_work(product_id)

Return the specified work.

Parameters:

product_id (str) – DLsite product ID.

Returns:

Complete work information.

Return type:

Work

async product_info(product_id)

Return ajax API product info.

Parameters:

product_id (str) – DLsite product ID.

Returns:

Minimal product information.

Raises:

DlsiteError – Failed to get product info.

Return type:

Work

class dlsite_async.EbookSession(play_api, ziptree, playfile, workno=None)

DLsite Play Ebook Viewer Session.

Parameters:
  • play_api (PlayAPI) – Parent PlayAPI session.

  • ziptree (ZipTree) – DLsite Play ZipTree for the ebook work. Must contain an ebook_fixed, ebook_webtoon or voicecomic_v2 playfile entry.

  • playfile (PlayFile) – PlayFile entry for the ebook to open in ziptree.

  • workno (str | None) – DLsite product ID for the ebook work (defaults to ziptree.workno).

async download_page(index, dest_dir, mkdir=False, audio=True, image=True, convert=None, force=False, **save_kwargs)

Download one ebook page to the specified location.

Parameters:
  • index (int) – Zero-indexed page number to download.

  • dest_dir (str | Path) – Destination directory to write the downloaded file.

  • mkdir (bool) – Create dest_dir and parent directories if they do not already exist.

  • force (bool) – Overwrite existing destination file if it already exists.

  • audio (bool) – Download audio for the page if it exists (only applicable for to voicecomic works).

  • image (bool) – Download image for the page if it exists.

  • convert (Literal['jpg', 'png'] | None) – Convert downloaded images to the specified format (requires optional dlsite-async[pil] dependency packages). By default, images are downloaded in the original DLsite Play Viewer WebP format. Only applicable when image is True.

  • save_kwargs (Any) – Additional arguments to be passed into Pillow Image.save(). Only applicable when convert is True.

Returns:

Downloaded file paths.

Raises:

FileExistsErrordest already exists.

Return type:

list[Path]

class dlsite_async.EpubFixedSession(play_api, ziptree, playfile, workno=None)

DLsite Play CSR (fixed-layout epub) Viewer Session.

Parameters:
  • play_api (PlayAPI) – Parent PlayAPI session.

  • ziptree (ZipTree) – DLsite Play ZipTree for the work. Must contain an epub playfile entry.

  • playfile (PlayFile) – PlayFile entry for the epub to open in ziptree.

  • workno (str | None) – DLsite product ID for the epub work (defaults to ziptree.workno).

async download_page(index, dest_dir, mkdir=False, descramble=False, force=False, **save_kwargs)

Download one ebook page to the specified location.

Parameters:
  • index (int) – Zero-indexed page number to download.

  • dest_dir (str | Path) – Destination directory to write the downloaded file.

  • mkdir (bool) – Create dest_dir and parent directories if they do not already exist.

  • force (bool) – Overwrite existing destination file if it already exists.

  • descramble (bool) – Descramble downloaded images (requires optional dlsite-async[pil] dependency packages).

  • save_kwargs (Any) – Additional arguments to be passed into Pillow Image.save(). Only applicable when descramble is True.

Returns:

Downloaded image paths (some pages may consist of multiple images).

Raises:

FileExistsError – destination file already exists.

Return type:

list[Path]

class dlsite_async.EpubReflowableSession(play_api, ziptree, playfile, workno=None)

DLsite Play CSR-R (reflowable epub) Viewer Session.

Parameters:
  • play_api (PlayAPI) – Parent PlayAPI session.

  • ziptree (ZipTree) – DLsite Play ZipTree for the work. Must contain an epub playfile entry.

  • playfile (PlayFile) – PlayFile entry for the epub to open in ziptree.

  • workno (str | None) – DLsite product ID for the epub work (defaults to ziptree.workno).

async download_epub(dest_dir, mkdir=False, force=False, **save_kwargs)

Download epub file to the specified location.

Parameters:
  • dest_dir (str | Path) – Destination directory to write the downloaded file.

  • mkdir (bool) – Create dest_dir and parent directories if they do not already exist.

  • force (bool) – Overwrite existing destination file if it already exists.

  • save_kwargs (Any)

Returns:

Downloaded file path.

Raises:

FileExistsError – destination file already exists.

Return type:

Path

class dlsite_async.EpubSession(**kwargs)
Parameters:
  • play_api (PlayAPI)

  • ziptree (ZipTree)

  • playfile (PlayFile)

  • workno (str | None)

class dlsite_async.MakerType(*values)

Maker type.

classmethod from_maker_id(maker_id)

Return MakerType from maker_id.

Parameters:

maker_id (str) – Maker ID

Returns:

Maker type.

Raises:

InvalidIDErrormaker_id was invalid.

Return type:

MakerType

class dlsite_async.PlayAPI(locale=None, **kwargs)

DLsite Play API session.

Parameters:
  • locale (str | None) – Optional locale. Defaults to ja_JP.

  • kwargs (Any)

async download_playfile(token, playfile, dest, mkdir=False, force=False, descramble=False, **save_kwargs)

Download playfile to the specified location.

Parameters:
  • token (DownloadToken) – A download token returned from download_token.

  • playfile (PlayFile) – PlayFile to download.

  • dest (str | Path) – Destination path to write the downloaded file.

  • mkdir (bool) – Create dest parent directories if they do not already exist.

  • force (bool) – Overwrite dest if it already exists.

  • descramble (bool) – Descramble downloaded images (requires optional dlsite-async[pil] dependency packages).

  • save_kwargs (Any) – Additional arguments to be passed into Pillow Image.save(). Only applicable when descramble is True.

Raises:

FileExistsErrordest already exists.

Return type:

None

async download_token(workno)

Return a download token for the specified workno.

Parameters:

workno (str) – DLsite product ID.

Returns:

A new download token.

Return type:

DownloadToken

async login(*args, **kwargs)

Login to DLsite Play.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

None

async purchases(last=None)

Iterate over purchased works.

Work information is populated using the Play API and may not match what would be returned when using DlsiteAPI.get_work(). Fields which are populated in both APIs will match, but not all fields are returned when using the Play API.

All purchased works will be yielded as long as that work is still downloadable or playable in DLsite Play. This may be useful for looking up metadata for works which are unavailable in DlsiteAPI.get_work() (i.e. time-limited purchase benefits or works which have been deleted or hidden by the original creator).

Purchased works which have been permanently removed will not be yielded (i.e. works where the original creator has completely removed their circle/maker account).

Parameters:

last (datetime | None) – Yield works purchased since last. Defaults to returning all works.

Return type:

AsyncIterator[tuple[Work, datetime | None]]

Yields: Tuples of the form (purchased_work, purchase_date).

Note

Play API requests are made concurrently and yielded as they are completed. Purchases are not guaranteed to be yielded in historical order.

async ziptree(token)

Return ziptree for the specified download.

Parameters:

token (DownloadToken) – A download token returned from download_token.

Returns:

A new zip tree.

Return type:

ZipTree

class dlsite_async.Work(product_id, site_id, maker_id, work_name, age_category, circle=None, brand=None, publisher=None, work_image=None, regist_date=None, work_type=None, book_type=None, announce_date=None, modified_date=None, scenario=None, illustration=None, voice_actor=None, author=None, music=None, writer=None, genre=None, label=None, event=None, file_format=None, file_size=None, language=None, page_count=None, description=None, sample_images=None, work_name_masked=None, title_name=None, title_name_masked=None)

DLsite work (product) class.

Parameters:
  • product_id (str)

  • site_id (str)

  • maker_id (str)

  • work_name (str)

  • age_category (AgeCategory)

  • circle (str | None)

  • brand (str | None)

  • publisher (str | None)

  • work_image (str | None)

  • regist_date (datetime | None)

  • work_type (WorkType | None)

  • book_type (BookType | None)

  • announce_date (datetime | None)

  • modified_date (datetime | None)

  • scenario (list[str] | None)

  • illustration (list[str] | None)

  • voice_actor (list[str] | None)

  • author (list[str] | None)

  • music (list[str] | None)

  • writer (list[str] | None)

  • genre (list[str] | None)

  • label (str | None)

  • event (list[str] | None)

  • file_format (list[str] | None)

  • file_size (str | None)

  • language (list[str] | None)

  • page_count (int | None)

  • description (str | None)

  • sample_images (list[str] | None)

  • work_name_masked (str | None)

  • title_name (str | None)

  • title_name_masked (str | None)

classmethod from_dict(d)

Construct Work from a dictionary.

Parameters:

d (Mapping[str, Any])

Return type:

Work

property release_date: datetime | None

Release date.

property series: str | None

Series name.

Set for backwards compatibility.

class dlsite_async.WorkType(*values)

Work type.

dlsite_async.find_maker_id(s)

Find a DLsite maker ID in a string.

Parameters:

s (str) – String containing a maker ID.

Returns:

Maker ID.

Raises:

InvalidIDErrors did not contain a valid maker ID.

Return type:

str

dlsite_async.find_product_id(s)

Find a DLsite product ID in a string.

Parameters:

s (str) – String containing a product ID.

Returns:

Product ID.

Raises:

InvalidIDErrors did not contain a valid product ID.

Return type:

str