epub2txt is a robust, efficient Python script to convert EPUB files to clean, readable, and LLM-friendly plain text.
epub2txt は、EPUB ファイルをクリーンで読みやすく、LLMにも適したプレーンテキストに変換する、堅牢で効率的な Python スクリプトです。
epub2txt 是一個強大且高效的 Python 腳本,用於將 EPUB 檔案轉換為清晰易讀且適合 LLM 使用的純文字。
.html/.htm/.xhtml files.-o points to a new folder, it will be created; -o is for single inputs only.Automatically set up the environment and install dependencies.
cd:
bash
cd /path/to/epub2txtbash
./run.shcmd.cd:
bat
cd C:\path\to\epub2txtbat
run.batIf you prefer to run it manually or don't want to use the helper scripts:
bash
# Mac / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
bat
:: Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtbash
# Mac / Linux
python3 epub2txt.py
bat
:: Windows
python epub2txt.pyNote: Replace ./run.sh with run.bat on Windows.
Custom Output Name
./run.sh myBook.epub -o myBook001.txt
Multiple Files
./run.sh book1.epub book2.epub
Multiple Files & Folders
./run.sh book1.epub /path/to/folder/ book2.epub
-o, each .epub becomes a .txt beside the source file. -o cannot be used with multiple inputs..html/.htm/.xhtml ファイルからテキストのみを保持します。-o で存在しないフォルダを指定した場合は作成します。-o は単一入力専用です。環境のセットアップと依存関係のインストールを自動的に行います。
cd を使用してスクリプトフォルダに移動します:
bash
cd /path/to/epub2txtbash
./run.shcmd を開きます。cd を使用してスクリプトフォルダに移動します:
bat
cd C:\path\to\epub2txtbat
run.bat手動で実行したい場合、またはヘルパースクリプトを使用したくない場合:
bash
# Mac / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
bat
:: Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt実行:
bash
# Mac / Linux
python3 epub2txt.py
bat
:: Windows
python epub2txt.py
注意: Windows では ./run.sh を run.bat に置き換えてください。
カスタム出力名
./run.sh myBook.epub -o myBook001.txt
複数のファイル
./run.sh book1.epub book2.epub
複数のファイルとフォルダ
./run.sh book1.epub /path/to/folder/ book2.epub
-o なしの場合、各 .epub は元ファイルと同じ場所に .txt として出力されます。-o は複数入力では使用できません。.html/.htm/.xhtml 文字。-o 指向的新資料夾不存在會自動建立;-o 只適用單檔輸入。自動設置環境並安裝依賴項。
cd 指令進入腳本資料夾:
bash
cd /path/to/epub2txtbash
./run.shcmd。cd 指令進入腳本資料夾:
bat
cd C:\path\to\epub2txtbat
run.bat如果您偏好手動執行或不想使用幫助腳本:
bash
# Mac / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
bat
:: Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt執行:
bash
# Mac / Linux
python3 epub2txt.py
bat
:: Windows
python epub2txt.py
注意: 在 Windows 上請將 ./run.sh 替換為 run.bat。
自定義輸出名稱
./run.sh myBook.epub -o myBook001.txt
多個檔案
./run.sh book1.epub book2.epub
多個檔案與資料夾
./run.sh book1.epub /path/to/folder/ book2.epub
-o 時,每個 .epub 會在原路徑旁輸出 .txt;多檔輸入時不可搭配 -o。$ claude mcp add epub2txt \
-- python -m otcore.mcp_server <graph>