aio-epub-translatelisted
Install: claude install-skill aiocean/claude-plugins
# EPUB Translate — Chapter Translation
Dịch nội dung EPUB bằng khả năng ngôn ngữ của Claude, submit bản dịch qua API.
> **Prerequisites**: Cần API key (`aio-epub-setup`) và sách đã upload (`aio-epub-upload`). Chưa có sách? Dùng `aio-epub-manage` để xem danh sách.
## API Setup
**LUÔN dùng Python** — KHÔNG dùng bash curl (JSON escaping lỗi với Unicode).
```python
import json, urllib.request, os
BASE = "https://read-api.aiocean.dev/ListBooks.v1.BookService"
KEY = os.environ.get("AIO_EPUB_API_KEY", "duocnv")
def api(method, body):
data = json.dumps(body).encode('utf-8')
req = urllib.request.Request(f"{BASE}/{method}", data=data, headers={
"Content-Type": "application/json",
"X-License-Key": KEY
})
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read())
```
## Workflow
### 1. Parse URL (nếu user gửi link)
URL format: `https://read.aiocean.io/books/{bookId}/read/{filePath}`
- `filePath` có thể double-encoded: `Text%252Fchapter0018.html` → `Text/chapter0018.html`
### 2. Lấy context TRƯỚC KHI DỊCH
```python
# Lấy cross-chapter context (guideline + glossary + previous chapter summary)
context = api("GetChapterContext", {
"bookId": BOOK_ID,
"filePath": FILE_PATH
})
guideline = context.get("guideline", "")
chapter_guideline = context.get("chapterGuideline", "")
previous_summary = context.get("previousChapterSummary", "")
glossary = context.get("glossary", [])
print("=== GUIDELINE ===")
print(guideline)
if chap