# Table of Contents - [Introduction | Enma](#introduction-enma) - [Cache | Enma](#cache-enma) - [Quick Start | Enma](#quick-start-enma) - [Google Drive | Enma](#google-drive-enma) - [Symbolic Links | Enma](#symbolic-links-enma) - [Authentication | Enma](#authentication-enma) - [Downloading Chapters | Enma](#downloading-chapters-enma) - [NHentai | Enma](#nhentai-enma) - [Downloaders | Enma](#downloaders-enma) - [Extending | Enma](#extending-enma) - [Sources | Enma](#sources-enma) - [Savers | Enma](#savers-enma) - [Errors | Enma](#errors-enma) - [Entrypoint Methods | Enma](#entrypoint-methods-enma) - [Download Chapter | Enma](#download-chapter-enma) - [Get | Enma](#get-enma) - [Paginate | Enma](#paginate-enma) - [Random | Enma](#random-enma) - [Author Page | Enma](#author-page-enma) - [Fetch Chapter By Symbolic Link | Enma](#fetch-chapter-by-symbolic-link-enma) - [Search | Enma](#search-enma) - [Introduction | Enma](#introduction-enma) - [Authentication | Enma](#authentication-enma) --- # Introduction | Enma ![enma](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252FzUyH8vUuQlz0CKfc75gA%252Fenma.png%3Falt%3Dmedia%26token%3Daed6308d-6d21-4ef6-8c1e-d904effe8680&width=768&dpr=3&quality=100&sign=80a4c2ce&sv=2) [![PyPI download month](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fpypi%2Fdm%2FEnma.svg&width=300&dpr=3&quality=100&sign=496da26d&sv=2)arrow-up-right](https://pypi.python.org/pypi/Enma/) [![codecov](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fcodecov.io%2Fgh%2FAlexandreSenpai%2FEnma%2Fbranch%2Fmaster%2Fgraph%2Fbadge.svg%3Ftoken%3DF3LP15DYMR&width=300&dpr=3&quality=100&sign=b8771a7c&sv=2)arrow-up-right](https://codecov.io/gh/AlexandreSenpai/Enma) [![Python 3.9+](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fbadge%2FPython-3.9%2B-blue.svg&width=300&dpr=3&quality=100&sign=bf2828da&sv=2)arrow-up-right](https://www.python.org/downloads/release/python-390/) [![PyPI license](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fpypi%2Fl%2Fansicolortags.svg&width=300&dpr=3&quality=100&sign=b8af8b76&sv=2)arrow-up-right](https://pypi.python.org/pypi/ansicolortags/) [![GitHub forks](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fforks%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=aa84af5d&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma) [![GitHub stars](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fstars%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=332026a1&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma) [![GitHub issues](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fissues%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=5bff831c&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma/issues) [hashtag](https://docs.minorin.io/enma#enma) Enma ------------------------------------------------------ Enma is a Python library designed to fetch manga and doujinshi data from many sources. It provides a unified interface to interact with different manga repositories, making it easier to retrieve manga details, search for manga, paginate through results, and fetch random manga. circle-exclamation **Enma is not intended for mass querying or placing heavy loads on supported sources. Please use responsibly, adhering to the terms of service of the data sources. Misuse may result in service disruption or access denial. (ㆆ\_ㆆ)** [hashtag](https://docs.minorin.io/enma#requirements) Requirements ---------------------------------------------------------------------- * Python 3.9+ [hashtag](https://docs.minorin.io/enma#installation) Installation ---------------------------------------------------------------------- Copy pip install --upgrade enma [hashtag](https://docs.minorin.io/enma#sources-feature-comparision) Sources Feature Comparision ---------------------------------------------------------------------------------------------------- NHentai Manganato Mangadex Search ✅ ✅ ✅ Random ✅ 🚫 ✅ Get ✅ ✅ ✅ Paginate ✅ ✅ ✅ Download ✅ ✅ ✅ Author Page ✅ 🚫 🚫 Set Config ✅ 🚫 🚫 Cache ✅ ✅ ✅ [hashtag](https://docs.minorin.io/enma#example) Example ------------------------------------------------------------ Copy from typing import cast from enma import Enma, Sources, CloudFlareConfig, NHentaI enma = Enma[Sources]() # or just Enma() config = CloudFlareConfig( user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36', cf_clearance='' ) enma.source_manager.set_source(source_name=Sources.NHENTAI) nh_source = cast(NHentai, enma.source_manager.source) nh_source.set_config(config=config) doujin = enma.random() print(doujin) [hashtag](https://docs.minorin.io/enma#dependencies) Dependencies ---------------------------------------------------------------------- * [requestsarrow-up-right](https://pypi.org/project/requests/) - Required to perform source code request; * [beautifulsoup4 arrow-up-right](https://pypi.org/project/beautifulsoup4) - Required to source code scrapping; * [pydantic arrow-up-right](https://pypi.org/project/pydantic) \- Required to args and DTO validations between application layers; * [expiringdictarrow-up-right](https://pypi.org/project/expiringdict/) - Required to caching results. [hashtag](https://docs.minorin.io/enma#disclaimer) [⚠️arrow-up-right](https://emojipedia.org/warning) Disclaimer ---------------------------------------------------------------------------------------------------------------------- ![](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252FIEy2zkPrhnngxaipJAVK%252F%281000x%29.gif%3Falt%3Dmedia%26token%3D0f4ca306-9515-4c95-9870-1ffe6799b71f&width=768&dpr=3&quality=100&sign=e881bc49&sv=2) This software is provided "as is", without warranty of any kind, express or implied. The developers and contributors of the Enma library shall not be liable for any misuse, damages, or other consequences arising from the use of this software. It is important to emphasize that the Enma library was developed with the goal of facilitating efficient and responsible access and manipulation of data. We do not encourage or support the use of this tool for conducting mass queries or accesses that could overload, harm, or in any way negatively affect the servers or services of the supported sources. Users of the Enma library must always follow the guidelines, terms of use, and limitations imposed by the accessed data sources. We strongly recommend the implementation of responsible rate limiting practices and obtaining appropriate permissions when necessary, to ensure that the use of the library complies with all applicable laws and regulations, in addition to respecting ethical principles of data use. By using the Enma library, you agree to use the tool in an ethical and responsible manner, acknowledging that the developers of Enma will not be responsible for any use that violates these guidelines. We remind you that respect for the services and APIs of the supported sources is fundamental for the sustainability and longevity of both the Enma and the services used. We value the community and the development ecosystem and encourage all users to contribute to a safer, more respectful, and collaborative digital environment. [NextQuick Startchevron-right](https://docs.minorin.io/enma/getting-started/quick-start) Last updated 1 year ago --- # Cache | Enma [hashtag](https://docs.minorin.io/enma/documentation/cache#understanding-caching-in-enma) Understanding Caching in Enma ---------------------------------------------------------------------------------------------------------------------------- When using the Enma library, it's beneficial to understand how caching works and how it impacts the performance of your applications. Caching is a crucial feature in Enma that significantly enhances efficiency and speed by storing the results of operations temporarily. This means that when you request the same data multiple times, instead of repeatedly querying the source (like an API), the library can retrieve the data from its cache, reducing load times and network traffic. [hashtag](https://docs.minorin.io/enma/documentation/cache#how-caching-affects-performance) **How Caching Affects Performance** ------------------------------------------------------------------------------------------------------------------------------------ Caching in Enma is implemented to improve the responsiveness of your applications by reducing the frequency of network requests to manga repositories. For example, if you're developing an application that frequently needs to fetch the latest chapters of a particular manga, caching these requests means that after the first retrieval, subsequent requests will be served from the cache until the cache expires. This reduces the wait time for users and decreases the load on the external APIs, ensuring faster and more reliable performance. [hashtag](https://docs.minorin.io/enma/documentation/cache#configuring-cache-settings) **Configuring Cache Settings** -------------------------------------------------------------------------------------------------------------------------- By default, Enma comes with predefined cache settings that are optimized for general use. However, you might find that your application has specific needs, such as longer or shorter cache durations depending on the frequency of content updates or user behavior patterns. You can easily adjust the cache behavior in Enma by setting environment variables. This flexibility allows you to control how long data stays in the cache without needing to modify the code directly. ### [hashtag](https://docs.minorin.io/enma/documentation/cache#cache-expiration-configuration) **Cache Expiration Configuration** The duration that data remains in the cache can be controlled through environment variables. For example, if you wish to change how long chapter information is cached in the `Mangadex` repository, you can set the following environment variable: * `ENMA_CACHING_FETCH_SYMBOLIC_LINK_TTL_IN_SECONDS` This variable determines the Time-To-Live (TTL) in seconds for caching the results of fetching chapters by symbolic links. Setting this variable to a higher value means that the cached data will be valid for a longer period, while a lower value means the data will expire quicker. To change the cache duration, you can set the environment variable in your deployment environment or directly in your development environment: Copy export ENMA_CACHING_FETCH_SYMBOLIC_LINK_TTL_IN_SECONDS=1800 # Sets the cache duration to 30 minutes By tuning these environment variables, you can optimize the caching strategy to fit the specific needs of your application, balancing between data freshness and performance efficiency. ### [hashtag](https://docs.minorin.io/enma/documentation/cache#available-cache-settings) Available Cache Settings Key Default ENMA\_CACHING\_STATE enabled/disabled **ENMA\_CACHING\_FETCH\_SYMBOLIC\_LINK\_TTL\_IN\_SECONDS** 100 **ENMA\_CACHING\_PAGINATE\_TTL\_IN\_SECONDS** 100 **ENMA\_CACHING\_SEARCH\_TTL\_IN\_SECONDS** 100 **ENMA\_CACHING\_GET\_TTL\_IN\_SECONDS** 300 **ENMA\_CACHING\_AUTHOR\_TTL\_IN\_SECONDS** 100 [hashtag](https://docs.minorin.io/enma/documentation/cache#summary) **Summary** ------------------------------------------------------------------------------------ Caching is a powerful feature in Enma that helps optimize the performance of your applications by reducing the number of API requests, which is particularly beneficial when dealing with rate-limited APIs. Adjusting cache settings through environment variables provides a flexible way to adapt the caching behavior to best suit your application's requirements. This ensures that your application can operate more efficiently while reducing the load on both your servers and the external services. [PreviousNHentaichevron-left](https://docs.minorin.io/enma/documentation/authentication/nhentai) [NextSymbolic Linkschevron-right](https://docs.minorin.io/enma/documentation/symbolic-links) Last updated 1 year ago --- # Quick Start | Enma circle-info **Good to know:** Some sources need a custom setting to make the website authentication before performing Enma operations. [hashtag](https://docs.minorin.io/enma/getting-started/quick-start#installing) Installing ---------------------------------------------------------------------------------------------- Terminal Copy # Install via pip pip install --upgrade enma [hashtag](https://docs.minorin.io/enma/getting-started/quick-start#fetching-manga) Fetching Manga ------------------------------------------------------------------------------------------------------ To successfully fetch your first manga you must have the manga id, you can get this information accessing the source website or using enma to make a searching before the fetching. Python Copy from enma import Enma enma = Enma() enma.source_manager.set_source('manganato') doujin = enma.get(identifier='manga-kb951984') [PreviousIntroductionchevron-left](https://docs.minorin.io/enma) [NextAuthenticationchevron-right](https://docs.minorin.io/enma/documentation/authentication) Last updated 1 year ago --- # Google Drive | Enma In addition to saving chapters to local storage, Enma now supports saving chapters directly to Google Drive. This is particularly useful if you want to store your downloaded manga in the cloud for easy access across multiple devices. [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters/google-drive#installation) **Installation** -------------------------------------------------------------------------------------------------------------------------- To use the Google Drive storage option, you need to install additional dependencies: Copy pip install enma[google_drive] ### [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters/google-drive#setting-up-credentials) **Setting Up Credentials** You'll need to set up Google Drive API credentials to allow Enma to upload files to your Google Drive account. Follow these steps: 1. **Selecione o Projeto** * No menu superior, clique no nome do projeto atual para abrir a lista de projetos e selecione o projeto onde deseja criar a Service Account. 1. **Acesse a Página de Service Accounts** * No menu de navegação lateral, clique em **IAM & Admin** > **Service Accounts**. 1. **Crie uma Nova Service Account** * Na página de Service Accounts, clique no botão **Create Service Account** (Criar Conta de Serviço). * Preencha o **Service Account Name** (Nome da Conta de Serviço), que será o identificador da sua conta. Opcionalmente, você pode adicionar uma descrição. * Clique em **Create and Continue** (Criar e Continuar). 1. **Pule a Etapa de Permissões** * Quando solicitado para adicionar permissões à Service Account, não adicione nenhuma permissão. Apenas clique em **Done** (Concluído) para criar a Service Account sem permissões associadas. 1. **Revisão e Finalização** * Após criar a Service Account, você voltará para a página principal de contas de serviço. A nova conta estará listada, mas sem permissões. 1. **Baixe a Chave JSON** * Se precisar de uma chave para autenticar usando a Service Account, clique na conta recém-criada, vá para a aba **Keys** (Chaves) e clique em **Add Key** > **Create New Key**. Escolha o formato **JSON** para baixar a chave. **Guarde o arquivo com segurança**, pois ele concede acesso para autenticação. 1. **Share Google Drive Folder with Service Account:** * In Google Drive, create a new folder or use an existing one. * Right-click the folder and select Share. * Share the folder with the service account's email address (found in the credentials JSON under client\_email). ### [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters/google-drive#example-usage) **Example Usage** Here's how you can use the GoogleDriveStorage adapter: Copy from enma import (Enma, ManganatoDownloader, GoogleDriveStorage, Threaded) enma = Enma() enma.source_manager.set_source('manganato') manga = enma.get(identifier='manga-wb999684') downloader = ManganatoDownloader() google_drive_storage = GoogleDriveStorage( credentials_path='path/to/your/service_account_credentials.json', root_shared_folder='your_root_folder_id_in_google_drive' ) if manga: enma.download_chapter( path=f'folder/subfolder/{manga.title.english}', chapter=manga.chapters[0], downloader=downloader, saver=google_drive_storage, threaded=Threaded(use_threads=True, number_of_threads=5) ) In this example: * Replace `path/to/your/service_account_credentials.json` with the path to your downloaded service account JSON credentials. * Replace `your_root_folder_id_in_google_drive` with the ID of the Google Drive folder where you want to save the chapters. * To get the folder ID, navigate to the folder in Google Drive and copy the ID from the URL (it's the string after folders/). * The path parameter specifies the folder structure within your root Google Drive folder where the chapter will be saved. [PreviousDownloading Chapterschevron-left](https://docs.minorin.io/enma/documentation/downloading-chapters) [NextExtendingchevron-right](https://docs.minorin.io/enma/documentation/extending) Last updated 1 year ago --- # Symbolic Links | Enma Enma offers a feature known as "Symbolic Links" to optimize the retrieval of manga chapters. This feature is particularly useful when working with manga that have a large number of chapters, as fetching all chapter data can be time-consuming. By utilizing symbolic links, Enma defers the full data fetch until it's specifically requested by the user. This document explains how to use symbolic links to efficiently access manga chapters. [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#what-are-symbolic-links) What are Symbolic Links? -------------------------------------------------------------------------------------------------------------------------- A Symbolic Link in the context of the Enma library is a reference to a manga chapter that doesn't immediately load all chapter details (such as pages). Instead, it provides a way to fetch those details on-demand. This approach significantly speeds up the process of getting manga information when the complete chapter data is not immediately needed. [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#how-to-use-symbolic-links) How to Use Symbolic Links ----------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#setting-up-enma) Setting Up Enma First, ensure you have Enma initialized and the desired source set. Here's a basic setup using the `manganato` source: Python Copy from enma import Enma enma = Enma() enma.source_manager.set_source('manganato') ### [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#retrieving-manga-with-symbolic-links) Retrieving Manga with Symbolic Links When retrieving manga details, you can specify the use of symbolic links. This tells Enma to create symbolic links for chapters instead of fetching all their data: Python Copy doujin = enma.get(identifier='manga-kb951984', with_symbolic_links=True) ### [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#accessing-a-chapter-through-a-symbolic-link) Accessing a Chapter through a Symbolic Link After obtaining a manga with chapters represented as symbolic links, you can access a specific chapter's full details on-demand using the symbolic link. Here's how you fetch data for the first chapter: Python Copy if doujin is not None and len(doujin.chapter) > 0: chapter_ref = doujin.chapters[0] # Reference to the first chapter's symbolic link chapter = enma.fetch_chapter_by_symbolic_link(chapter=chapter_ref) # Now you can access chapter details, such as pages ### [hashtag](https://docs.minorin.io/enma/documentation/symbolic-links#example) Example Python Copy from enma import Enma enma = Enma() enma.source_manager.set_source('manganato') doujin = enma.get(identifier='manga-kb951984', with_symbolic_links=True) if doujin is not None and len(doujin.chapters) > 0: chapter_ref = doujin.chapters[0] chapter = enma.fetch_chapter_by_symbolic_link(chapter=chapter_ref) # Use `chapter` to access its full details now Symbolic links are a powerful feature in Enma that allow for efficient manga data retrieval, especially for manga with a large number of chapters. By deferring the full data fetch to when it's specifically needed, applications can perform faster and provide a better user experience. [PreviousCachechevron-left](https://docs.minorin.io/enma/documentation/cache) [NextDownloading Chapterschevron-right](https://docs.minorin.io/enma/documentation/downloading-chapters) Last updated 1 year ago --- # Authentication | Enma To access certain manga and doujinshi sources through Enma, some may require authentication. For these sources, users must provide their login credentials or API keys as part of the configuration. This ensures secure access to content that may be restricted or require a user account. Always ensure your credentials are kept secure and use them according to the source's terms of service. For detailed steps on how to configure authentication for specific sources, refer to the pages below. [PreviousQuick Startchevron-left](https://docs.minorin.io/enma/getting-started/quick-start) [NextNHentaichevron-right](https://docs.minorin.io/enma/documentation/authentication/nhentai) Last updated 1 year ago --- # Downloading Chapters | Enma Enma provides a robust way to download manga chapters directly to your local storage or any compatible storage system through the `ISaverAdapter` interface. This feature is essential for users looking to create offline manga collections or manage large volumes of manga data efficiently. [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#requirements) Requirements --------------------------------------------------------------------------------------------------------- Before proceeding, ensure you have Enma set up and configured to use the `manganato` source. You will also need to have a manga identifier for the manga you wish to download chapters from. [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#download-setup) Download Setup ------------------------------------------------------------------------------------------------------------- The following components are crucial for downloading chapters * **Downloader:** Responsible for fetching chapter pages from the source. * **Saver:** Defines where and how downloaded pages are saved. * **Threaded Download:** Optimize download performance using multiple threads. [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#example) Example ----------------------------------------------------------------------------------------------- Here's how you can download a chapter using Enma: Python Copy from enma import (Enma, CloudFlareConfig, ManganatoDownloader, Threaded, LocalStorage) enma = Enma() enma.source_manager.set_source('manganato') manga = enma.get(identifier='manga-wb999684') downloader = ManganatoDownloader() local_storage = LocalStorage() if manga: enma.download_chapter(path=f'./download/{manga.title.english}', chapter=manga.chapters[0], downloader=downloader, saver=local_storage, threaded=Threaded(use_threads=True, number_of_threads=5)) ### [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#download_chapter-function-explained) `download_chapter` Function Explained #### [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#key-components) Key Components * **Threaded:** A data class to manage threaded downloads, including whether to use threading and the number of threads. * **path:** Contains all necessary data for downloading a chapter, such as the chapter itself, path to save, downloader, saver, and threading details. * **DownloadChapterUseCase:** Orchestrates the downloading process, handling both threaded and synchronous downloads. #### [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#handling-downloads-and-saves) Handling Downloads and Saves The process uses a queue to manage downloaded pages, ensuring that saving to storage happens even as downloads continue. This is particularly efficient when using threads, as it allows for concurrent downloading and saving, speeding up the overall process. [hashtag](https://docs.minorin.io/enma/documentation/downloading-chapters#conclusion) Conclusion ----------------------------------------------------------------------------------------------------- Using Enma to download manga chapters is a powerful and flexible way to manage manga collections. By leveraging threading and customizable saving options, users can efficiently download large volumes of manga data for offline viewing or archival purposes. [PreviousSymbolic Linkschevron-left](https://docs.minorin.io/enma/documentation/symbolic-links) [NextGoogle Drivechevron-right](https://docs.minorin.io/enma/documentation/downloading-chapters/google-drive) Last updated 1 year ago --- # NHentai | Enma ![](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252Fwe3LYGBHjcDt9qxCRSDP%252FMens-Nhentai-logo-shirt.png%3Falt%3Dmedia%26token%3D2220436f-e8a1-4b40-ac77-3419055d67dc&width=768&dpr=3&quality=100&sign=7f433bdf&sv=2) circle-exclamation **This has become optional since NHentai stopped requiring Cloudflare's cookies** Authentication Flow for NHentai Source in Enma When using Enma to access content from NHentai, it's crucial to understand that NHentai employs Cloudflare's anti-bot measures, which necessitate a special authentication flow to ensure seamless access. This process involves retrieving a User-Agent and a CF\_Clearance cookie, which are essential for bypassing Cloudflare's security checks and accessing NHentai's content through the Enma library. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#retrieving-user-agent-and-cf_clearence-cookie) Retrieving User Agent And CF\_Clearence Cookie ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Open your web browser and navigate to the NHentai website. This step is necessary to trigger and pass Cloudflare's anti-bot verification manually. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#open-developer-tools) Open Developer Tools --------------------------------------------------------------------------------------------------------------------------- * **For Google Chrome**: Right-click on the webpage and select Inspect or simply press Ctrl + Shift + I (or Cmd + Option + I on Mac). * **For Firefox**: Right-click on the webpage and select Inspect Element or press Ctrl + Shift + I (or Cmd + Option + I on Mac). [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#navigate-to-the-network-tab) Navigate to the Network Tab ----------------------------------------------------------------------------------------------------------------------------------------- In the Developer Tools panel, click on the Network tab. This tab captures all network requests made by the webpage. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#reload-the-page) Reload the Page ----------------------------------------------------------------------------------------------------------------- With the Network tab open, reload the NHentai website by pressing Ctrl + R (or Cmd + R on Mac). This ensures that all network requests are captured. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#select-nhentai.net-request) Select nhentai.net Request --------------------------------------------------------------------------------------------------------------------------------------- After reloading, you'll see a list of files on the left side of the Network tab. Click on the first file named nhentai.net. This represents the main request to the NHentai website. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#find-the-request-headers) Find the Request Headers ----------------------------------------------------------------------------------------------------------------------------------- On the right side, you'll see several tabs like Headers, Preview, Response, etc. Make sure you're on the Headers tab. Scroll down until you find a section named Request Headers. [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#copy-user-agent-and-cf_clearence-tokens) Copy User-Agent and CF\_Clearence Tokens ------------------------------------------------------------------------------------------------------------------------------------------------------------------ * **user-agent**: This is a string that tells the server which web browser is being used. Look for an entry named User-Agent and copy its value. * **cf\_clearance**: This is a specific cookie set by CloudFlare for security purposes. Look for an entry named cf\_clearance and copy its value. ![](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252F7DlpJVVVmyOZWZvFxRzw%252Fuser-agent.png%3Falt%3Dmedia%26token%3D9e2e28d0-00f0-46c2-979c-e868554e57a7&width=768&dpr=3&quality=100&sign=655aeb7d&sv=2) [hashtag](https://docs.minorin.io/enma/documentation/authentication/nhentai#setting-enma-up-with-new-tokens) Setting Enma Up With New Tokens ------------------------------------------------------------------------------------------------------------------------------------------------- Once you have obtained the `CF_Clearance` cookie and your `User-Agent`, you need to configure Enma to use these values when making requests to NHentai. This involves setting the `CF_Clearance` cookie and the `User-Agent` in your script or application where you're utilizing Enma to access NHentai. Here's a general way to set these in Enma: Python Copy from enma import Enma config = CloudFlareConfig( user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36', cf_clearance='' ) enma = Enma() enma.source_manager.set_source('nhentai') enma.source_manager.source.set_config(config=config) circle-info The user-agent and cf\_clearance values can change over time. If you encounter issues accessing NHentai through the Enma library, you might need to repeat the above steps to get updated values. [PreviousAuthenticationchevron-left](https://docs.minorin.io/enma/documentation/authentication) [NextCachechevron-right](https://docs.minorin.io/enma/documentation/cache) Last updated 1 year ago --- # Downloaders | Enma Downloaders are responsible for fetching manga pages from the internet. The need for custom downloaders arises when dealing with unique source requirements, such as specific request headers, handling CAPTCHAs, or optimizing download speeds. [hashtag](https://docs.minorin.io/enma/documentation/extending/downloaders#implementation) Implementation -------------------------------------------------------------------------------------------------------------- To create a custom downloader, you must implement the IDownloaderAdapter abstract base class (ABC). This class requires the implementation of a single method, download, which takes a manga Image object as input and returns a BytesIO object containing the image data. ### [hashtag](https://docs.minorin.io/enma/documentation/extending/downloaders#example) **Example** Python Copy from abc import ABC, abstractmethod from io import BytesIO from enma.domain.entities.manga import Image import requests class CustomDownloader(IDownloaderAdapter): @abstractmethod def download(self, page: Image) -> BytesIO: response = requests.get(page.uri) if response.status_code == 200: return BytesIO(response.content) else: raise Exception(f"Failed to download page: {page.uri}") [PreviousSourceschevron-left](https://docs.minorin.io/enma/documentation/extending/sources) [NextSaverschevron-right](https://docs.minorin.io/enma/documentation/extending/savers) Last updated 1 year ago --- # Extending | Enma Enma's architecture is designed to be extensible, allowing users to implement custom downloaders and savers according to their specific needs. This flexibility is crucial for adapting to different manga sources, storage systems, and optimization requirements. Here, we'll discuss how to extend the downloader and saver components within the Enma framework. [PreviousGoogle Drivechevron-left](https://docs.minorin.io/enma/documentation/downloading-chapters/google-drive) [NextSourceschevron-right](https://docs.minorin.io/enma/documentation/extending/sources) Last updated 1 year ago --- # Sources | Enma The Enma library is a powerful tool for accessing and managing manga data from various sources. To further enhance its capabilities and functionalities, Enma allows for contributions by extending it with custom sources. This guide provides an overview of how you can contribute to the Enma library by adding your own manga sources. [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#defining-a-new-source-optional) Defining a New Source \[ Optional \] ------------------------------------------------------------------------------------------------------------------------------------------------ ### [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#create-custom-sources-enum) **Create Custom Sources Enum** First, create an enumeration (`enum`) that extends `SourcesEnum` from Enma, including all existing sources and your new custom source. Python Copy from enum import Enum class AvailableSources(Enum): NHENTAI = 'nhentai' MANGANATO = 'manganato' YOUR_CUSTOM_SOURCE = 'your-custom-source' # Add your custom source here [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#implement-the-imangarepository-interface) **Implement the** `**IMangaRepository**` **Interface** ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- For your source to be compatible with Enma, it must implement the IMangaRepository interface. This means your source class to respect the contract shown below: Python Copy from abc import ABC, abstractmethod from typing import Any, Union from enma.domain.entities.author_page import AuthorPage from enma.domain.entities.manga import Chapter, Manga, SymbolicLink from enma.domain.entities.pagination import Pagination from enma.domain.entities.search_result import SearchResult class IMangaRepository(ABC): @abstractmethod def set_config(self, config: Any) -> None: ... @abstractmethod def get(self, identifier: str, with_symbolic_links: bool) -> Union[Manga, None]: ... @abstractmethod def search(self, query: str, page: int, **kwargs) -> SearchResult: ... @abstractmethod def paginate(self, page: int) -> Pagination: ... @abstractmethod def random(self) -> Manga: ... @abstractmethod def author_page(self, author: str, page: int) -> AuthorPage: ... @abstractmethod def fetch_chapter_by_symbolic_link(self, link: SymbolicLink) -> Chapter: ... Each method should be implemented according to the specifications and operational logic of your custom source. [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#enhance-with-caching) Enhance with Caching ---------------------------------------------------------------------------------------------------------------------- Integrate caching into your custom source to improve performance. For instance, you can decorate methods like `get`, `search`, or `paginate` with caching logic, specifying the TTL (time to live) through environment variables to control cache expiration dynamically. Python Copy from enma.infra.core.utils.cache import Cache class YourCustomSourceClass(IMangaRepository): @Cache(max_age_seconds=300, max_size=20).cache def get(self, identifier: str, with_symbolic_links: bool = False) -> Manga: # Implementation goes here pass [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#registering-and-using-your-new-source) Registering and Using Your New Source -------------------------------------------------------------------------------------------------------------------------------------------------------- After defining your source and implementing `IMangaRepository`, you need to register this new source with the Enma instance and set when to use it. ### [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#instantiate-enma-with-your-custom-source) **Instantiate Enma with Your Custom Source** Python Copy from enma import Enma enma = Enma() ### [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#add-your-source-to-the-source-manager) **Add Your Source to the Source Manager** Python Copy enma.source_manager.add_source(source_name='your-custom-source', source=YourCustomSourceClass()) Ensure that `YourCustomSourceClass()` is an instance of your source class that implements `IMangaRepository`. [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#set-your-source-as-active) **Set Your Source as Active** ------------------------------------------------------------------------------------------------------------------------------------ Python Copy enma.source_manager.set_source(source_name=AvailableSources.YOUR_CUSTOM_SOURCE) ### [hashtag](https://docs.minorin.io/enma/documentation/extending/sources#testing-your-source) Testing Your Source After registering your custom source, it's important to test it to ensure it functions as expected. You can test basic functionalities like searching, getting a random manga, and more Python Copy # Testing search search_results = enma.search("One Piece") print(search_results) # Getting a random manga random_manga = enma.random() print(random_manga) Contributing custom sources to the Enma library not only enriches the tool with more options and diversity of content but also offers the opportunity to customize the manga browsing and reading experience. By following the steps outlined, you can easily add your own source, contributing to the Enma community and expanding the library's reach. If you encounter any challenges or have improvements to suggest, consider contributing to the Enma project on GitHub, where the community can benefit from your contributions. [PreviousExtendingchevron-left](https://docs.minorin.io/enma/documentation/extending) [NextDownloaderschevron-right](https://docs.minorin.io/enma/documentation/extending/downloaders) Last updated 1 year ago --- # Savers | Enma Savers manage the storage of downloaded manga pages. This component is essential for defining how and where manga pages are stored, such as on local disk, in a cloud storage bucket, or within a database. [hashtag](https://docs.minorin.io/enma/documentation/extending/savers#implementation) Implementation --------------------------------------------------------------------------------------------------------- To create a custom saver, you should implement the ISaverAdapter ABC. This class mandates the implementation of the save method, which accepts a file path and a File object (containing the file name and data as a BytesIO object) and returns a boolean indicating the success of the operation. ### [hashtag](https://docs.minorin.io/enma/documentation/extending/savers#example) **Example** Python Copy from abc import ABC, abstractmethod from dataclasses import dataclass from io import BytesIO import os from enma.application.core.interfaces.saver_adapter import File, ISaverAdapter class CustomSaver(ISaverAdapter): def save(self, path: str, file: File) -> bool: full_path = os.path.join(path, file.name) try: with open(full_path, 'wb') as f: f.write(file.data.getvalue()) return True except Exception as e: print(f"Failed to save file {file.name}: {e}") return False By extending the saver interface, Enma users can tailor the manga storage process to their specific requirements. Whether it's optimizing for speed, handling complex source-specific challenges, or integrating with unique storage solutions, custom savers unlock a high degree of flexibility and control. This extensibility is a cornerstone of Enma's design, ensuring it can adapt to a wide range of manga collection and management scenarios. [PreviousDownloaderschevron-left](https://docs.minorin.io/enma/documentation/extending/downloaders) [NextErrorschevron-right](https://docs.minorin.io/enma/documentation/errors) Last updated 1 year ago --- # Errors | Enma While using the library, you might encounter some specific errors. Here's a description of each: [hashtag](https://docs.minorin.io/enma/documentation/errors#instanceerror) InstanceError --------------------------------------------------------------------------------------------- * **Description:** Raised when an instance of an object is not of the expected type. * **Common Cause:** Trying to add a source that isn't an instance of IMangaRepository. * **Code**: INSTANCE\_ERROR [hashtag](https://docs.minorin.io/enma/documentation/errors#sourcenotavailable) SourceNotAvailable ------------------------------------------------------------------------------------------------------- * **Description:** Raised when attempting to access a source that isn't available in the defined source list. * **Common Cause:** Trying to set a source that hasn't been previously added. * **Code:** SOURCE\_NOT\_AVAILABLE [hashtag](https://docs.minorin.io/enma/documentation/errors#sourcewasnotdefined) SourceWasNotDefined --------------------------------------------------------------------------------------------------------- * **Description:** Raised when trying to perform an action (like fetching a manga) without first defining a source. * **Common Cause:** Forgetting to set the source before performing an operation. * **Code**: SOURCE\_WAS\_NOT\_DEFINED [hashtag](https://docs.minorin.io/enma/documentation/errors#exceedretrycount) ExceedRetryCount --------------------------------------------------------------------------------------------------- * **Description:** Specific to the NHentai adapter. Raised when the random method fails to fetch a random doujin after several attempts. * **Common Cause**: Consecutive failures when trying to fetch a random doujin from NHentai. * **Code**: EXCEED\_RETRY\_COUNT [hashtag](https://docs.minorin.io/enma/documentation/errors#nhentaisourcewithoutconfig) NHentaiSourceWithoutConfig ----------------------------------------------------------------------------------------------------------------------- * **Description:** Raised when trying to make a request to NHentai without providing the necessary configurations. * **Common Cause:** Forgetting to provide the `user-agent` and `cf_clearance` when configuring the NHentai adapter. See more information about it on [Authentication](https://docs.minorin.io/enma/documentation/authentication) * **Code**: NHENTAI\_SOURCE\_WITHOUT\_CONFIG [hashtag](https://docs.minorin.io/enma/documentation/errors#invalidresource) InvalidResource ------------------------------------------------------------------------------------------------- * **Description**: Raised when trying to perform an action with an invalid or inexistent resource. * **Common Cause**: Providing an inexistent folder path to downloader. * **Code**: INVALID\_RESOURCE [hashtag](https://docs.minorin.io/enma/documentation/errors#invalidrequest) InvalidRequest ----------------------------------------------------------------------------------------------- * **Description**: Raised when trying to perform an action with an invalid data type. * **Common Cause**: Making an action with wrong parameter data type. * **Code**: INVALID\_REQUEST [hashtag](https://docs.minorin.io/enma/documentation/errors#unknown) Unknown --------------------------------------------------------------------------------- * **Description**: Raised when was not possible to determine the error root cause. * **Common Cause**: Not properly handled error. * **Code**: UNKNOWN [hashtag](https://docs.minorin.io/enma/documentation/errors#notfound) NotFound ----------------------------------------------------------------------------------- * **Description**: Raised when was not possible to find the requested resource. * **Common Cause**: Fetching an inexistent resource. * **Code**: NOT\_FOUND [hashtag](https://docs.minorin.io/enma/documentation/errors#forbidden) Forbidden ------------------------------------------------------------------------------------- * **Description**: Raised when trying to perform a request to the source without right credentials. * **Common Cause**: Making a request with no or invalid credentials. * **Code**: FORBIDDEN [hashtag](https://docs.minorin.io/enma/documentation/errors#exceedratelimit) ExceedRateLimit ------------------------------------------------------------------------------------------------- * **Description**: Raised when trying to perform more requests than a server can handle. * **Common Cause**: Looping through many pages without cooling down. * **Code**: EXCEED\_RATE\_EXCEED When encountering one of these errors, refer to the description and common cause to assist in troubleshooting. [PreviousSaverschevron-left](https://docs.minorin.io/enma/documentation/extending/savers) [NextEntrypoint Methodschevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods) Last updated 1 year ago --- # Entrypoint Methods | Enma Here, you will find comprehensive guidance on how to utilize the key functionalities of the Enma library effectively. The Enma library is designed to simplify the process of accessing and managing manga data from various sources, providing a robust set of entrypoints that allow you to fetch, search, paginate, and download manga content with ease. On this page, you'll explore detailed examples and explanations of each entrypoint method available in the Enma library. These methods are crucial for integrating manga data into your applications, enabling you to create dynamic and responsive manga-related projects. Whether you're looking to retrieve detailed manga information, search through extensive databases, or manage downloads of manga chapters, these entrypoints provide the tools you need to achieve your goals efficiently. The entrypoint methods covered on this page include: * `**get**`: Fetch detailed information about specific manga by ID. * `**search**`: Perform searches across manga repositories based on query strings. * `**paginate**`: Navigate through manga listings in a paginated format. * `**random**`: Retrieve a random manga for discovery and recommendation purposes. * `**download_chapter**`: Download specific manga chapters using customizable settings. * `**author_page**`: Access manga authored by specific writers. * `**fetch_chapter_by_symbolic_link**`: Retrieve manga chapters using symbolic links for optimized data fetching. Each section provides syntax, parameters, return types, and practical examples to help you understand how to implement and use these methods in real-world scenarios. Whether you're a seasoned developer or just starting with manga applications, this documentation will serve as a valuable resource to leverage the full potential of the Enma library. Let's dive into each method and explore how you can enhance your manga-related projects with Enma's powerful features! [PreviousErrorschevron-left](https://docs.minorin.io/enma/documentation/errors) [NextGetchevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/get) Last updated 1 year ago --- # Download Chapter | Enma Downloads a manga chapter to the specified path using provided downloader and saver adapters. This method supports threaded downloads for faster processing. * **Parameters:** * `path`: Filesystem path where the chapter should be saved. * `chapter`: The manga chapter to download. * `downloader`: Adapter for downloading chapter pages. * `saver`: Adapter for saving the downloaded pages. * `threaded`: Determines whether the download should be performed in a threaded manner. * **Raises:** `SourceWasNotDefined` if no source has been set before calling this method. Python Copy # Example to download a chapter of a manga from enma import ( DefaultDownloader, LocalStorage, Threaded ) path = "./downloads" chapter = Chapter(id="1", pages=[], link=None) # Example chapter object downloader = DefaultDownloader() saver = LocalStorage() enma.download_chapter( path=path, chapter=chapter, downloader=downloader, saver=saver, threaded=Threaded(use_threads=True, number_of_threads=4) ) print("Chapter downloaded successfully.") [PreviousRandomchevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/random) [NextAuthor Pagechevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/author-page) Last updated 1 year ago --- # Get | Enma This method retrieves detailed information about a specific manga identified by its unique identifier (ID). If `with_symbolic_links` is set to `True`, it fetches the manga with symbolic links to chapters, which can be useful for lazy loading of chapter details. * **Parameters:** * `identifier`: Unique identifier of the manga. * `with_symbolic_links`: Fetches the manga with symbolic links if set to `True`. * **Returns:** A `Manga` object containing detailed information if found, or `None` otherwise. * **Raises:** `SourceWasNotDefined` if no source has been set before calling this method. Python Copy # Example to retrieve a specific manga by its ID with symbolic links to chapters manga_id = "12345" manga = enma.get(identifier=manga_id, with_symbolic_links=True) if manga: print(f"Manga Title: {manga.title.english}") else: print("Manga not found.") [PreviousEntrypoint Methodschevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods) [NextSearchchevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/search) Last updated 1 year ago --- # Paginate | Enma Retrieves a specific page of manga listings, providing a way to navigate through manga entries in a paginated format. * **Parameters:** * `page`: Page number of manga listings to retrieve. * **Returns:** A `Pagination` object containing the paginated list of manga thumbnails and pagination details. * **Raises:** `SourceWasNotDefined` if no source has been set before calling this method. Python Copy # Example to retrieve a specific page of manga listings page_number = 2 pagination = enma.paginate(page=page_number) for manga in pagination.results: print(f"Manga Title: {manga.title}") [PreviousSearchchevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/search) [NextRandomchevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/random) Last updated 1 year ago --- # Random | Enma Fetches a random manga from the currently selected source. This is useful for discovering new manga or generating recommendations. * **Returns:** A `Manga` object for the randomly selected manga. * **Raises:** * `SourceWasNotDefined` if no source has been set before calling this method. * `NotImplementedError` if the current source does not support random fetching. Python Copy # Example to fetch a random manga try: random_manga = enma.random() print(f"Random Manga Title: {random_manga.title.english}") except NotImplementedError: print("Error: Random functionality not supported.") [PreviousPaginatechevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/paginate) [NextDownload Chapterchevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/download-chapter) Last updated 1 year ago --- # Author Page | Enma Fetches manga authored by a specific individual, useful for fans of particular authors. * **Parameters:** * `author`: Name or identifier of the author. * `page`: Page number of results to retrieve. * **Returns:** An `AuthorPage` object containing a list of manga by the specified author. * **Raises:** * `SourceWasNotDefined` if no source has been set before calling this method. * `NotImplementedError` if the current source does not support fetching an author's page. Python Copy # Example to fetch manga authored by a specific author author_name = "Oda Eiichiro" try: author_page = enma.author_page(author=author_name, page=1) for manga in author_page.results: print(f"Manga Title: {manga.title}") except NotImplementedError: print("Error: author functionality not supported.") [PreviousDownload Chapterchevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/download-chapter) [NextFetch Chapter By Symbolic Linkchevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/fetch-chapter-by-symbolic-link) Last updated 1 year ago --- # Fetch Chapter By Symbolic Link | Enma Fetches details of a manga chapter including pages and images by its symbolic link, facilitating efficient data loading. * **Parameters:** * `chapter`: The manga chapter to fetch, which must include a valid symbolic link. * **Returns:** A `Chapter` object containing the fetched chapter details. * **Raises:** * `SourceWasNotDefined` if no source has been set before calling this method. * `InvalidResource` if the provided chapter does not have a valid symbolic link. Python Copy # Example to fetch a chapter by its symbolic link symbolic_link = SymbolicLink(link="http://example.com/chapter/1") chapter = Chapter(id="1", pages=[], link=symbolic_link) try: detailed_chapter = enma.fetch_chapter_by_symbolic_link(chapter=chapter) print(f"Fetched {len(detailed_chapter.pages)} pages.") except InvalidResource: print("Error: Invalid chapter link.") [PreviousAuthor Pagechevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/author-page) Last updated 1 year ago --- # Search | Enma Searches for manga that match a given query string. This method supports pagination and can take additional keyword arguments to customize search parameters. * **Parameters:** * `query`: Search query string to match manga titles or descriptions. * `page`: Page number of search results to retrieve. * `**kwargs`: Additional parameters for search customization. * **Returns:** A `SearchResult` object containing the paginated search results, including manga thumbnails. * **Raises:** `SourceWasNotDefined` if no source has been set before calling this method. Python Copy # Example to search for manga with a specific query query = "Naruto" page_number = 1 search_results = enma.search(query=query, page=page_number) for manga in search_results.results: print(f"Manga Title: {manga.title}") [hashtag](https://docs.minorin.io/enma/documentation/entrypoint-methods/search#sorting) Sorting ---------------------------------------------------------------------------------------------------- Some sources supports sorting and you can use passing sort key as kwargs. Python Copy from enma import Enma, MangadexSort enma = Enma() enma.source_manager.set_source("mangadex") search = enma.search( query="Koyomi Araragi", page=1, sort=MangadexSort.ALL_TIME ) for result in search.results: print(f"[{result.id}] - {result.title}") ### [hashtag](https://docs.minorin.io/enma/documentation/entrypoint-methods/search#supported-sorting) Supported Sorting The sources below currently supports query sorting * Mangadex: **MangadexSort** * NHentai: **NHentaiSort** [PreviousGetchevron-left](https://docs.minorin.io/enma/documentation/entrypoint-methods/get) [NextPaginatechevron-right](https://docs.minorin.io/enma/documentation/entrypoint-methods/paginate) Last updated 1 year ago --- # Introduction | Enma ![enma](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252FzUyH8vUuQlz0CKfc75gA%252Fenma.png%3Falt%3Dmedia%26token%3Daed6308d-6d21-4ef6-8c1e-d904effe8680&width=768&dpr=3&quality=100&sign=80a4c2ce&sv=2) [![PyPI download month](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fpypi%2Fdm%2FEnma.svg&width=300&dpr=3&quality=100&sign=496da26d&sv=2)arrow-up-right](https://pypi.python.org/pypi/Enma/) [![codecov](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fcodecov.io%2Fgh%2FAlexandreSenpai%2FEnma%2Fbranch%2Fmaster%2Fgraph%2Fbadge.svg%3Ftoken%3DF3LP15DYMR&width=300&dpr=3&quality=100&sign=b8771a7c&sv=2)arrow-up-right](https://codecov.io/gh/AlexandreSenpai/Enma) [![Python 3.9+](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fbadge%2FPython-3.9%2B-blue.svg&width=300&dpr=3&quality=100&sign=bf2828da&sv=2)arrow-up-right](https://www.python.org/downloads/release/python-390/) [![PyPI license](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fpypi%2Fl%2Fansicolortags.svg&width=300&dpr=3&quality=100&sign=b8af8b76&sv=2)arrow-up-right](https://pypi.python.org/pypi/ansicolortags/) [![GitHub forks](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fforks%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=aa84af5d&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma) [![GitHub stars](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fstars%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=332026a1&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma) [![GitHub issues](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2Fimg.shields.io%2Fgithub%2Fissues%2FAlexandreSenpai%2FEnma&width=300&dpr=3&quality=100&sign=5bff831c&sv=2)arrow-up-right](https://github.com/AlexandreSenpai/Enma/issues) [hashtag](https://docs.minorin.io/enma/getting-started#enma) Enma ---------------------------------------------------------------------- Enma is a Python library designed to fetch manga and doujinshi data from many sources. It provides a unified interface to interact with different manga repositories, making it easier to retrieve manga details, search for manga, paginate through results, and fetch random manga. circle-exclamation **Enma is not intended for mass querying or placing heavy loads on supported sources. Please use responsibly, adhering to the terms of service of the data sources. Misuse may result in service disruption or access denial. (ㆆ\_ㆆ)** [hashtag](https://docs.minorin.io/enma/getting-started#requirements) Requirements -------------------------------------------------------------------------------------- * Python 3.9+ [hashtag](https://docs.minorin.io/enma/getting-started#installation) Installation -------------------------------------------------------------------------------------- Copy pip install --upgrade enma [hashtag](https://docs.minorin.io/enma/getting-started#sources-feature-comparision) Sources Feature Comparision -------------------------------------------------------------------------------------------------------------------- NHentai Manganato Mangadex Search ✅ ✅ ✅ Random ✅ 🚫 ✅ Get ✅ ✅ ✅ Paginate ✅ ✅ ✅ Download ✅ ✅ ✅ Author Page ✅ 🚫 🚫 Set Config ✅ 🚫 🚫 Cache ✅ ✅ ✅ [hashtag](https://docs.minorin.io/enma/getting-started#example) Example ---------------------------------------------------------------------------- Copy from typing import cast from enma import Enma, Sources, CloudFlareConfig, NHentaI enma = Enma[Sources]() # or just Enma() config = CloudFlareConfig( user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36', cf_clearance='' ) enma.source_manager.set_source(source_name=Sources.NHENTAI) nh_source = cast(NHentai, enma.source_manager.source) nh_source.set_config(config=config) doujin = enma.random() print(doujin) [hashtag](https://docs.minorin.io/enma/getting-started#dependencies) Dependencies -------------------------------------------------------------------------------------- * [requestsarrow-up-right](https://pypi.org/project/requests/) - Required to perform source code request; * [beautifulsoup4 arrow-up-right](https://pypi.org/project/beautifulsoup4) - Required to source code scrapping; * [pydantic arrow-up-right](https://pypi.org/project/pydantic) \- Required to args and DTO validations between application layers; * [expiringdictarrow-up-right](https://pypi.org/project/expiringdict/) - Required to caching results. [hashtag](https://docs.minorin.io/enma/getting-started#disclaimer) [⚠️arrow-up-right](https://emojipedia.org/warning) Disclaimer -------------------------------------------------------------------------------------------------------------------------------------- ![](https://docs.minorin.io/enma/~gitbook/image?url=https%3A%2F%2F1729253516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fh9iC1635f9DsT4f10Toq%252Fuploads%252FIEy2zkPrhnngxaipJAVK%252F%281000x%29.gif%3Falt%3Dmedia%26token%3D0f4ca306-9515-4c95-9870-1ffe6799b71f&width=768&dpr=3&quality=100&sign=e881bc49&sv=2) This software is provided "as is", without warranty of any kind, express or implied. The developers and contributors of the Enma library shall not be liable for any misuse, damages, or other consequences arising from the use of this software. It is important to emphasize that the Enma library was developed with the goal of facilitating efficient and responsible access and manipulation of data. We do not encourage or support the use of this tool for conducting mass queries or accesses that could overload, harm, or in any way negatively affect the servers or services of the supported sources. Users of the Enma library must always follow the guidelines, terms of use, and limitations imposed by the accessed data sources. We strongly recommend the implementation of responsible rate limiting practices and obtaining appropriate permissions when necessary, to ensure that the use of the library complies with all applicable laws and regulations, in addition to respecting ethical principles of data use. By using the Enma library, you agree to use the tool in an ethical and responsible manner, acknowledging that the developers of Enma will not be responsible for any use that violates these guidelines. We remind you that respect for the services and APIs of the supported sources is fundamental for the sustainability and longevity of both the Enma and the services used. We value the community and the development ecosystem and encourage all users to contribute to a safer, more respectful, and collaborative digital environment. [NextQuick Startchevron-right](https://docs.minorin.io/enma/getting-started/quick-start) Last updated 1 year ago --- # Authentication | Enma To access certain manga and doujinshi sources through Enma, some may require authentication. For these sources, users must provide their login credentials or API keys as part of the configuration. This ensures secure access to content that may be restricted or require a user account. Always ensure your credentials are kept secure and use them according to the source's terms of service. For detailed steps on how to configure authentication for specific sources, refer to the pages below. [PreviousQuick Startchevron-left](https://docs.minorin.io/enma/getting-started/quick-start) [NextNHentaichevron-right](https://docs.minorin.io/enma/documentation/authentication/nhentai) Last updated 1 year ago ---