mirror of
https://gitlab.com/vyla-entertainment/documentation.git
synced 2026-11-17 07:57:23 -05:00
117 lines
3.6 KiB
Markdown
117 lines
3.6 KiB
Markdown
# Manga Resolution Module
|
|
|
|
<p class="page-description">How to integrate manga title discovery, chapter listings, and high-resolution page resolution using the Vyla SDK.</p>
|
|
|
|
## Overview
|
|
|
|
In addition to video streaming, `@vyla-entertainment/sdk` includes a native Manga resolution module. Powered by `atsu.moe` and leveraging `node-tls-client`, the module bypasses anti-bot TLS fingerprinting by mimicking real Google Chrome 131 cryptographic handshakes.
|
|
|
|
This allows developers to build responsive, ad-free manga reading interfaces directly into their applications.
|
|
|
|
---
|
|
|
|
## Technical Architecture
|
|
|
|
Upstream manga archives frequently block standard Node.js `fetch` or `axios` requests using JA3/JA4 TLS fingerprinting. To ensure reliable connectivity:
|
|
|
|
1. **TLS Emulation**: Uses `node-tls-client` configured with `ClientIdentifier.chrome_131`.
|
|
2. **Session Persistence**: Reuses keep-alive TLS sessions across search and chapter page requests.
|
|
3. **Structured Geometry**: Returns explicit image dimensions (`width`, `height`) and pre-calculated aspect ratios so mobile and desktop readers can prevent layout shifts during image loading.
|
|
|
|
---
|
|
|
|
## Manga Methods
|
|
|
|
### 1. Searching for Titles
|
|
|
|
Search the manga catalog by query string with pagination support:
|
|
|
|
```javascript
|
|
import VylaSDK from '@vyla-entertainment/sdk';
|
|
|
|
const sdk = new VylaSDK();
|
|
|
|
const searchResult = await sdk.searchManga('Chainsaw Man', 1, 10);
|
|
|
|
console.log(`Total results: ${searchResult.total}`);
|
|
searchResult.items.forEach((manga) => {
|
|
console.log(`[ID: ${manga.id}] ${manga.title} - ${manga.latestChapter}`);
|
|
});
|
|
```
|
|
|
|
#### Search Response Structure
|
|
```json
|
|
{
|
|
"page": 1,
|
|
"perPage": 10,
|
|
"total": 42,
|
|
"items": [
|
|
{
|
|
"id": "chainsaw-man",
|
|
"title": "Chainsaw Man",
|
|
"cover": "https://cdn.atsu.moe/covers/chainsaw-man.webp",
|
|
"status": "Ongoing",
|
|
"latestChapter": "Chapter 180"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
### 2. Fetching Manga Details & Chapters
|
|
|
|
Retrieve full metadata, descriptions, genres, and the complete chapter index:
|
|
|
|
```javascript
|
|
const mangaDetails = await sdk.getManga('chainsaw-man');
|
|
|
|
console.log('Title:', mangaDetails.title);
|
|
console.log('Synopsis:', mangaDetails.description);
|
|
console.log('Genres:', mangaDetails.genres.join(', '));
|
|
console.log('Available Chapters:', mangaDetails.chapters.length);
|
|
|
|
const latest = mangaDetails.chapters[0];
|
|
console.log(`Latest Chapter: ${latest.chapterNumber} (ID: ${latest.id})`);
|
|
```
|
|
|
|
---
|
|
|
|
### 3. Resolving Chapter Pages
|
|
|
|
To render the reader view, fetch the ordered page image assets for a specific chapter:
|
|
|
|
```javascript
|
|
const mangaId = 'chainsaw-man';
|
|
const chapterId = 'chapter-1';
|
|
|
|
const pages = await sdk.getMangaChapter(mangaId, chapterId);
|
|
|
|
console.log(`Chapter contains ${pages.length} pages.`);
|
|
|
|
pages.forEach((page, index) => {
|
|
console.log(`Page ${index + 1}: ${page.url} [${page.width}x${page.height}]`);
|
|
});
|
|
```
|
|
|
|
#### Page Object Structure
|
|
```json
|
|
{
|
|
"index": 1,
|
|
"url": "https://cdn.atsu.moe/data/.../01.webp",
|
|
"width": 1080,
|
|
"height": 1600,
|
|
"aspectRatio": 0.675
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Reader Layout Best Practices
|
|
|
|
When rendering manga pages in a frontend reader:
|
|
|
|
1. **Prevent Cumulative Layout Shift (CLS)**: Use the provided `aspectRatio` or `width`/`height` in CSS (`aspect-ratio: attr(width) / attr(height);`) to reserve vertical scroll space before each image finishes downloading.
|
|
2. **Preload Neighboring Pages**: Implement a 2-page lookahead preloader so viewers turning pages experience instantaneous transitions.
|
|
3. **Session Cleanup**: In long-running background tasks, invoke `cleanup()` from the module when closing reader sessions to terminate idle TLS sockets.
|