wattpdl 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wattpdl-1.0.0/LICENSE +21 -0
- wattpdl-1.0.0/PKG-INFO +488 -0
- wattpdl-1.0.0/README.md +455 -0
- wattpdl-1.0.0/pyproject.toml +66 -0
- wattpdl-1.0.0/setup.cfg +4 -0
- wattpdl-1.0.0/src/wattpdl/__init__.py +3 -0
- wattpdl-1.0.0/src/wattpdl/__main__.py +5 -0
- wattpdl-1.0.0/src/wattpdl/api.py +76 -0
- wattpdl-1.0.0/src/wattpdl/app.py +280 -0
- wattpdl-1.0.0/src/wattpdl/cli.py +234 -0
- wattpdl-1.0.0/src/wattpdl/cli_args.py +65 -0
- wattpdl-1.0.0/src/wattpdl/config.py +37 -0
- wattpdl-1.0.0/src/wattpdl/progress.py +46 -0
- wattpdl-1.0.0/src/wattpdl/writers.py +128 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/PKG-INFO +488 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/SOURCES.txt +19 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/dependency_links.txt +1 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/entry_points.txt +2 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/requires.txt +9 -0
- wattpdl-1.0.0/src/wattpdl.egg-info/top_level.txt +1 -0
- wattpdl-1.0.0/tests/test_wattpdl.py +244 -0
wattpdl-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nekonaru
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
wattpdl-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wattpdl
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Script Python + Rich CLI untuk mengunduh cerita Wattpad ke .txt/.docx offline
|
|
5
|
+
Author: nekonaru
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/nekonaru/wattpdl
|
|
8
|
+
Project-URL: Repository, https://github.com/nekonaru/wattpdl
|
|
9
|
+
Project-URL: Issues, https://github.com/nekonaru/wattpdl/issues
|
|
10
|
+
Keywords: wattpad,downloader,cli,scraper,offline-reading
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Environment :: Console
|
|
19
|
+
Classifier: Topic :: Internet
|
|
20
|
+
Classifier: Topic :: Utilities
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: requests>=2.31
|
|
25
|
+
Requires-Dist: rich>=13.7
|
|
26
|
+
Requires-Dist: python-docx>=1.1
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.16; extra == "dev"
|
|
30
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
██╗ ██╗ █████╗ ████████╗████████╗██████╗ ██████╗ ██╗
|
|
38
|
+
██║ ██║██╔══██╗╚══██╔══╝╚══██╔══╝██╔══██╗██╔══██╗██║
|
|
39
|
+
██║ █╗ ██║███████║ ██║ ██║ ██████╔╝██║ ██║██║
|
|
40
|
+
██║███╗██║██╔══██║ ██║ ██║ ██╔═══╝ ██║ ██║██║
|
|
41
|
+
╚███╔███╔╝██║ ██║ ██║ ██║ ██║ ██████╔╝███████╗
|
|
42
|
+
╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 📖 Wattpad Story Downloader
|
|
46
|
+
**Simpan cerita favoritmu jadi file `.txt` atau `.docx`, lengkap atau per chapter, secara offline.**
|
|
47
|
+
|
|
48
|
+
<br>
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+

|
|
52
|
+

|
|
53
|
+

|
|
54
|
+

|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
## ✨ Tentang Project
|
|
60
|
+
|
|
61
|
+
**WattPDL** adalah script Python ringan yang mengunduh chapter dari cerita Wattpad pilihanmu, lalu menyimpannya sebagai file `.txt` atau dokumen Word `.docx` yang bersih dan rapi. Kamu bisa unduh seluruh cerita jadi satu file, semua chapter terpisah dalam satu `.zip`, atau cukup chapter tertentu yang kamu pilih sendiri. Tidak perlu login, tidak perlu API key, cukup link atau ID ceritanya.
|
|
62
|
+
|
|
63
|
+
> _"Karena cerita yang bagus layak dibaca kapan saja, bahkan tanpa internet."_
|
|
64
|
+
|
|
65
|
+
## 🎯 Fitur
|
|
66
|
+
|
|
67
|
+
| Fitur | Keterangan |
|
|
68
|
+
|-------|------------|
|
|
69
|
+
| 🎨 **Tampilan CLI rapi** | Panel, tabel info cerita, dan warna berkat library `rich` |
|
|
70
|
+
| 🧩 **4 mode unduh** | Semua jadi 1 file, semua terpisah dalam `.zip`, pilih beberapa chapter, atau cukup 1 chapter |
|
|
71
|
+
| 📄 **2 pilihan format** | Simpan sebagai `.txt` polos atau dokumen Word `.docx` |
|
|
72
|
+
| 📁 **Pilih folder simpan** | Default ke folder `Downloads` sistem, bisa dikustomisasi |
|
|
73
|
+
| 🔄 **Auto-retry** | Chapter gagal dicoba ulang hingga 3× sebelum dilewati |
|
|
74
|
+
| 📊 **Progress bar animasi** | Spinner, persentase, jumlah chapter, dan estimasi waktu tersisa |
|
|
75
|
+
| 📋 **Ringkasan akhir** | Panel laporan chapter yang gagal (jika ada) setelah selesai |
|
|
76
|
+
| 🗂 **Nama file aman** | Karakter ilegal otomatis dihapus dari nama file |
|
|
77
|
+
| 🔗 **Link sumber tersimpan** | URL cerita dicantumkan di header file hasil |
|
|
78
|
+
| ⚡ **Tanpa login** | Pakai endpoint publik Wattpad, jadi tidak butuh akun |
|
|
79
|
+
| ↻ **Resume otomatis** | Kalau proses terhenti di tengah jalan, jalankan ulang cerita yang sama — chapter yang sudah berhasil tidak diunduh ulang |
|
|
80
|
+
| ⚙️ **Ingat preferensi** | Folder simpan & format file terakhir otomatis dipakai lagi di sesi berikutnya |
|
|
81
|
+
| 🤖 **Mode non-interaktif** | Bisa dijalankan lewat argumen command line untuk scripting/otomatisasi, tanpa perlu jawab prompt |
|
|
82
|
+
|
|
83
|
+
## 📦 Requirements
|
|
84
|
+
|
|
85
|
+
- **Python** 3.9 atau lebih baru
|
|
86
|
+
- **Koneksi internet**
|
|
87
|
+
- Library: `requests`, `rich`, `python-docx` — otomatis terinstall bareng `wattpdl`, tidak perlu diinstall manual
|
|
88
|
+
|
|
89
|
+
### Belum pernah pakai terminal? Ikuti ini dulu
|
|
90
|
+
|
|
91
|
+
<details>
|
|
92
|
+
<summary><b>🪟 Cara buka terminal di Windows</b></summary>
|
|
93
|
+
|
|
94
|
+
1. Tekan tombol **Windows**, ketik `PowerShell`, lalu tekan **Enter**
|
|
95
|
+
2. Jendela hitam/biru akan terbuka. Itu tempat kamu mengetik perintah
|
|
96
|
+
3. Semua perintah `python ...` atau `pip ...` di panduan ini diketik di jendela itu, lalu tekan **Enter**
|
|
97
|
+
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
<details>
|
|
101
|
+
<summary><b>🍎 Cara buka terminal di macOS</b></summary>
|
|
102
|
+
|
|
103
|
+
1. Tekan **Cmd + Spasi**, ketik `Terminal`, lalu tekan **Enter**
|
|
104
|
+
2. Ketik perintah-perintah di panduan ini di situ, lalu tekan **Enter**
|
|
105
|
+
|
|
106
|
+
</details>
|
|
107
|
+
|
|
108
|
+
<details>
|
|
109
|
+
<summary><b>🐧 Cara buka terminal di Linux</b></summary>
|
|
110
|
+
|
|
111
|
+
Tekan **Ctrl + Alt + T**, atau cari aplikasi "Terminal" di menu aplikasi.
|
|
112
|
+
|
|
113
|
+
</details>
|
|
114
|
+
|
|
115
|
+
### Belum punya Python?
|
|
116
|
+
|
|
117
|
+
1. Buka [python.org/downloads](https://www.python.org/downloads/) dan unduh versi terbaru
|
|
118
|
+
2. **Khusus Windows**: saat instalasi, centang dulu kotak **"Add Python to PATH"** di layar pertama sebelum klik Install. Kalau ini kelewat, perintah `python` nanti tidak akan dikenali
|
|
119
|
+
3. Setelah selesai install, buka terminal (lihat panduan di atas) lalu cek dengan:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python --version
|
|
123
|
+
# atau
|
|
124
|
+
python3 --version
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Kalau muncul angka versi (misal `Python 3.12.1`), berarti sudah siap.
|
|
128
|
+
|
|
129
|
+
## 🚀 Instalasi
|
|
130
|
+
|
|
131
|
+
### Cara A: Install dari PyPI (paling gampang)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install wattpdl
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
> Kalau `pip` tidak dikenali, coba:
|
|
138
|
+
> ```bash
|
|
139
|
+
> python -m pip install wattpdl
|
|
140
|
+
> ```
|
|
141
|
+
|
|
142
|
+
> Kalau muncul error `externally-managed-environment` (biasanya di Linux):
|
|
143
|
+
> ```bash
|
|
144
|
+
> pip install wattpdl --break-system-packages
|
|
145
|
+
> ```
|
|
146
|
+
|
|
147
|
+
Setelah terinstall, command `wattpdl` langsung bisa dipakai dari terminal mana saja — lanjut ke bagian [Cara Pakai](#️-cara-pakai).
|
|
148
|
+
|
|
149
|
+
### Cara B: Install dari source (untuk development / mau lihat/ubah kode)
|
|
150
|
+
|
|
151
|
+
**1. Ambil kode project ini**
|
|
152
|
+
|
|
153
|
+
<details>
|
|
154
|
+
<summary><b>Punya Git terinstall</b></summary>
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
git clone https://github.com/nekonaru/wattpdl.git
|
|
158
|
+
cd wattpdl
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
</details>
|
|
162
|
+
|
|
163
|
+
<details>
|
|
164
|
+
<summary><b>Tidak punya Git</b></summary>
|
|
165
|
+
|
|
166
|
+
1. Buka halaman repository di GitHub
|
|
167
|
+
2. Klik tombol hijau **`Code`** → pilih **`Download ZIP`**
|
|
168
|
+
3. Ekstrak file ZIP yang terunduh ke folder pilihanmu
|
|
169
|
+
4. Di terminal, masuk ke folder hasil ekstrak, contoh:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cd Downloads/wattpdl-main
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
|
|
177
|
+
**2. Install dalam mode "editable"**
|
|
178
|
+
```bash
|
|
179
|
+
pip install -e .
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
> Sama seperti Cara A, tambahkan `--break-system-packages` di akhir kalau muncul error `externally-managed-environment`.
|
|
183
|
+
|
|
184
|
+
Ini juga mendaftarkan command `wattpdl`, tapi mengambil kodenya langsung dari folder ini — cocok kalau kamu mau modifikasi kode dan langsung lihat hasilnya tanpa install ulang.
|
|
185
|
+
|
|
186
|
+
## 🖥️ Cara Pakai
|
|
187
|
+
|
|
188
|
+
**Jalankan:**
|
|
189
|
+
```bash
|
|
190
|
+
wattpdl
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
> Kalau kamu install dari source tanpa `pip install -e .`, jalankan lewat `python -m wattpdl` dari dalam folder `src/` — tapi cara Editable Install di atas lebih direkomendasikan.
|
|
194
|
+
|
|
195
|
+
**Masukkan link atau ID cerita saat diminta:**
|
|
196
|
+
```
|
|
197
|
+
Link atau ID cerita Wattpad: https://www.wattpad.com/story/123456789-judul-cerita
|
|
198
|
+
```
|
|
199
|
+
atau cukup ID-nya:
|
|
200
|
+
```
|
|
201
|
+
Link atau ID cerita Wattpad: 123456789
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Pilih mode unduh:**
|
|
205
|
+
```
|
|
206
|
+
1 Semua chapter → 1 file gabungan
|
|
207
|
+
2 Semua chapter → file terpisah per chapter, dikemas .zip
|
|
208
|
+
3 Pilih beberapa chapter → 1 file gabungan
|
|
209
|
+
4 Pilih 1 chapter saja
|
|
210
|
+
|
|
211
|
+
Pilih mode [1/2/3/4] (1):
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- **Mode 1**: cara paling umum, seluruh cerita jadi satu file rapi dari chapter pertama sampai terakhir
|
|
215
|
+
- **Mode 2**: cocok kalau mau baca per chapter terpisah, hasilnya satu `.zip` berisi file per chapter
|
|
216
|
+
- **Mode 3**: muncul daftar semua judul chapter bernomor, lalu ketik nomor yang mau diunduh, bisa gabung koma dan rentang, contoh: `1,3,5-8`
|
|
217
|
+
- **Mode 4**: muncul daftar semua judul chapter, ketik satu nomor untuk unduh chapter itu saja
|
|
218
|
+
|
|
219
|
+
**Pilih format file:**
|
|
220
|
+
```
|
|
221
|
+
1 Teks polos (.txt)
|
|
222
|
+
2 Dokumen Word (.docx)
|
|
223
|
+
|
|
224
|
+
Pilih format file [1/2] (1):
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Pilih folder penyimpanan:**
|
|
228
|
+
```
|
|
229
|
+
Folder default: C:\Users\user\Downloads
|
|
230
|
+
Tekan Enter untuk pakai folder itu, atau ketik path lain:
|
|
231
|
+
```
|
|
232
|
+
Tekan **Enter** untuk simpan di `Downloads`, atau ketik path kustom seperti:
|
|
233
|
+
- Windows: `D:\Cerita\Wattpad`
|
|
234
|
+
- Linux/macOS: `/home/user/cerita`
|
|
235
|
+
|
|
236
|
+
**Tunggu proses selesai:**
|
|
237
|
+
```
|
|
238
|
+
⠋ Chapter 24... ████████████████░░░░░░░░░░░░░░ 53.3% 24/45 0:00:12 sisa 0:00:11
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Done! 🎉**
|
|
242
|
+
```
|
|
243
|
+
╔══════ 🎉 Berhasil! Semua chapter tersimpan ══════╗
|
|
244
|
+
║ 📁 File tersimpan di C:\Users\user\Downloads\Judul_Cerita.txt ║
|
|
245
|
+
║ ✅ Berhasil 45/45 ║
|
|
246
|
+
║ ⏱️ Waktu total 2m 18d ║
|
|
247
|
+
╚═══════════════════════════════════════════════════╝
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## ↻ Resume Otomatis
|
|
251
|
+
|
|
252
|
+
Kalau proses unduh terhenti di tengah jalan (koneksi putus, terminal ditutup, laptop mati), setiap chapter yang **sudah berhasil** diunduh tersimpan otomatis di `~/.wattpdl/progress/<id_cerita>.json`.
|
|
253
|
+
|
|
254
|
+
Jalankan lagi dengan cerita yang sama (ID/link sama), dan WattPDL akan:
|
|
255
|
+
- Melewati chapter yang sudah berhasil (dipakai dari cache, tidak fetch ulang)
|
|
256
|
+
- Hanya mengunduh chapter yang belum berhasil / gagal sebelumnya
|
|
257
|
+
|
|
258
|
+
File progress otomatis dihapus setelah semua chapter berhasil diunduh dalam satu sesi. Kalau mau paksa unduh ulang dari awal, hapus manual folder `~/.wattpdl/progress/`.
|
|
259
|
+
|
|
260
|
+
## ⚙️ Preferensi Tersimpan
|
|
261
|
+
|
|
262
|
+
Folder simpan dan format file terakhir yang kamu pilih otomatis tersimpan di `~/.wattpdl/config.json`, dan dipakai lagi sebagai default di sesi berikutnya — gak perlu isi ulang tiap kali jalanin script.
|
|
263
|
+
|
|
264
|
+
## 🤖 Mode Non-Interaktif (Scripting/Otomatisasi)
|
|
265
|
+
|
|
266
|
+
Selain mode tanya-jawab, WattPDL juga bisa dijalankan lewat argumen command line — cocok buat dijadwalkan (cron/Task Scheduler) atau dipanggil dari script lain.
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
wattpdl --id 398440633 --mode 1 --format docx
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Argumen yang tersedia:**
|
|
273
|
+
|
|
274
|
+
| Argumen | Keterangan |
|
|
275
|
+
|---|---|
|
|
276
|
+
| `--id` | ID atau link cerita Wattpad. Mengisi ini mengaktifkan mode non-interaktif. |
|
|
277
|
+
| `--mode {1,2,3,4}` | 1 = semua jadi 1 file, 2 = semua terpisah `.zip`, 3 = pilih beberapa chapter, 4 = pilih 1 chapter |
|
|
278
|
+
| `--format {txt,docx}` | Format file output. Default: dari config tersimpan, atau `txt` |
|
|
279
|
+
| `--chapters` | Nomor chapter untuk `--mode 3`, contoh: `1,3,5-8` |
|
|
280
|
+
| `--chapter` | Nomor chapter untuk `--mode 4`, contoh: `5` |
|
|
281
|
+
| `--output-dir` | Folder penyimpanan custom. Default: dari config tersimpan, atau folder `Downloads` |
|
|
282
|
+
|
|
283
|
+
**Contoh lain:**
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Unduh semua chapter sebagai .zip terpisah
|
|
287
|
+
wattpdl --id 398440633 --mode 2 --format txt
|
|
288
|
+
|
|
289
|
+
# Unduh chapter 1, 3, dan 5-8 saja, jadi 1 file gabungan
|
|
290
|
+
wattpdl --id 398440633 --mode 3 --chapters 1,3,5-8 --format docx
|
|
291
|
+
|
|
292
|
+
# Unduh chapter 10 saja, simpan ke folder custom
|
|
293
|
+
wattpdl --id 398440633 --mode 4 --chapter 10 --output-dir "D:\Cerita Wattpad"
|
|
294
|
+
|
|
295
|
+
# Lihat semua opsi
|
|
296
|
+
wattpdl --help
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## 📂 Struktur Output
|
|
300
|
+
|
|
301
|
+
Nama dan bentuk file yang dihasilkan tergantung mode & format yang kamu pilih:
|
|
302
|
+
|
|
303
|
+
| Mode | Format `.txt` | Format `.docx` |
|
|
304
|
+
|------|----------------|-----------------|
|
|
305
|
+
| 1 - Semua, gabungan | `Judul_Cerita.txt` | `Judul_Cerita.docx` |
|
|
306
|
+
| 2 - Semua, terpisah | `Judul_Cerita.zip` (isi: `.txt` per chapter) | `Judul_Cerita.zip` (isi: `.docx` per chapter) |
|
|
307
|
+
| 3 - Beberapa chapter | `Judul_Cerita_pilihan.txt` | `Judul_Cerita_pilihan.docx` |
|
|
308
|
+
| 4 - Satu chapter | `Judul_Cerita_Ch003_Nama_Chapter.txt` | `Judul_Cerita_Ch003_Nama_Chapter.docx` |
|
|
309
|
+
|
|
310
|
+
**Isi file gabungan (mode 1 & 3):** judul cerita, penulis, dan sumber di bagian atas, lalu tiap chapter dipisah dengan penanda `#####`.
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
Judul Cerita
|
|
314
|
+
oleh Nama Penulis
|
|
315
|
+
Sumber : https://www.wattpad.com/story/123456789
|
|
316
|
+
|
|
317
|
+
==================================================
|
|
318
|
+
|
|
319
|
+
##### Judul Chapter 1 #####
|
|
320
|
+
|
|
321
|
+
Isi teks chapter 1...
|
|
322
|
+
|
|
323
|
+
##### Judul Chapter 2 #####
|
|
324
|
+
|
|
325
|
+
Isi teks chapter 2...
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Di versi `.docx`, judul cerita jadi heading utama dan tiap chapter otomatis jadi Heading 1 dengan halaman baru, tinggal buka di Word atau Google Docs dan langsung enak dibaca.
|
|
329
|
+
|
|
330
|
+
**Isi zip (mode 2):** satu file per chapter, bernomor urut sesuai posisi di cerita, plus `000_info.txt`/`000_info.docx` berisi judul, penulis, dan sumber. Ekstensi file di dalam zip mengikuti format yang dipilih saat menjalankan script (`.txt` atau `.docx`):
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
Judul_Cerita.zip
|
|
334
|
+
├── 000_info.txt
|
|
335
|
+
├── 001_Judul_Chapter_1.txt
|
|
336
|
+
├── 002_Judul_Chapter_2.txt
|
|
337
|
+
└── ...
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## 🗺️ Default Folder per OS
|
|
341
|
+
|
|
342
|
+
| Sistem Operasi | Folder Default |
|
|
343
|
+
|----------------|----------------|
|
|
344
|
+
| 🪟 Windows | `C:\Users\<namauser>\Downloads` |
|
|
345
|
+
| 🍎 macOS | `/Users/<namauser>/Downloads` |
|
|
346
|
+
| 🐧 Linux | `/home/<namauser>/Downloads` |
|
|
347
|
+
|
|
348
|
+
## ⚠️ Troubleshooting
|
|
349
|
+
|
|
350
|
+
| Masalah | Solusi |
|
|
351
|
+
|---------|--------|
|
|
352
|
+
| `ModuleNotFoundError: No module named 'requests'` | Jalankan `pip install requests` |
|
|
353
|
+
| `ModuleNotFoundError: No module named 'rich'` | Jalankan `pip install rich` |
|
|
354
|
+
| `Library 'python-docx' belum terinstall` | Jalankan `pip install python-docx` (cuma dibutuhkan kalau memilih format `.docx`) |
|
|
355
|
+
| Error `404` / "Tidak ada chapter ditemukan" | Pastikan ID/link benar & cerita tidak di-private |
|
|
356
|
+
| Folder tidak bisa dibuat | Cek path valid & kamu punya izin tulis di sana |
|
|
357
|
+
| Proses macet di satu chapter | Cek koneksi internet, jalankan ulang, progress akan lanjut |
|
|
358
|
+
|
|
359
|
+
## 📝 Catatan Penting
|
|
360
|
+
|
|
361
|
+
- ID cerita adalah angka di URL Wattpad, tepat setelah `/story/`
|
|
362
|
+
- Script memakai endpoint publik, tidak butuh login atau API key
|
|
363
|
+
- Jeda **0.5 detik** antar chapter sudah diatur untuk menghindari rate limit server, jangan dihapus
|
|
364
|
+
- Script ini hanya untuk membaca cerita milik sendiri atau cerita publik secara offline. Hormati hak cipta penulis
|
|
365
|
+
|
|
366
|
+
## 🛠️ Dibuat dengan
|
|
367
|
+
|
|
368
|
+

|
|
369
|
+

|
|
370
|
+

|
|
371
|
+

|
|
372
|
+

|
|
373
|
+
|
|
374
|
+
## 🗂️ Struktur Project
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
wattpdl/
|
|
378
|
+
├── src/
|
|
379
|
+
│ └── wattpdl/
|
|
380
|
+
│ ├── __init__.py # metadata package (__version__)
|
|
381
|
+
│ ├── __main__.py # entry untuk `python -m wattpdl`
|
|
382
|
+
│ ├── app.py # orkestrasi alur program (main())
|
|
383
|
+
│ ├── api.py # komunikasi ke Wattpad public API
|
|
384
|
+
│ ├── writers.py # konversi teks & penulisan file .txt/.docx/.zip
|
|
385
|
+
│ ├── cli.py # tampilan terminal (rich), interaksi dengan user
|
|
386
|
+
│ ├── cli_args.py # parsing argumen untuk mode non-interaktif
|
|
387
|
+
│ ├── config.py # simpan preferensi user (folder simpan, format)
|
|
388
|
+
│ └── progress.py # cache progress unduhan untuk fitur resume
|
|
389
|
+
├── requirements.txt # daftar dependency (untuk referensi manual)
|
|
390
|
+
├── pyproject.toml # metadata package + build config + ruff
|
|
391
|
+
├── tests/
|
|
392
|
+
│ ├── __init__.py
|
|
393
|
+
│ └── test_wattpdl.py # unit test (pytest)
|
|
394
|
+
├── .github/
|
|
395
|
+
│ └── workflows/
|
|
396
|
+
│ ├── tests.yml # CI: test, lint, & build check otomatis
|
|
397
|
+
│ └── publish.yml # auto-publish ke PyPI saat rilis baru
|
|
398
|
+
├── CONTRIBUTING.md # panduan kontribusi
|
|
399
|
+
├── LICENSE
|
|
400
|
+
└── README.md
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Prinsip pemisahan modul:**
|
|
404
|
+
- `api.py` — tidak tahu apa-apa soal tampilan (`rich`), murni fetch data
|
|
405
|
+
- `writers.py` — tidak melakukan request jaringan, murni konversi & tulis file
|
|
406
|
+
- `cli.py` — semua interaksi dengan user & tampilan progress bar
|
|
407
|
+
- `cli_args.py` — parsing & validasi argumen command line, tidak ada logika bisnis
|
|
408
|
+
- `config.py` / `progress.py` — baca-tulis file JSON di `~/.wattpdl/`, tidak tahu soal CLI atau jaringan
|
|
409
|
+
- `app.py` — menyatukan semuanya, tanpa logika bisnis sendiri (dipanggil lewat command `wattpdl` setelah install)
|
|
410
|
+
|
|
411
|
+
## 🧪 Testing
|
|
412
|
+
|
|
413
|
+
Ada unit test untuk fungsi-fungsi inti (parsing ID cerita, validasi nama file, parsing pilihan chapter, konversi HTML ke teks, config, progress/resume, parsing argumen CLI, dll).
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
pip install -e .[dev]
|
|
417
|
+
pytest tests/ -v
|
|
418
|
+
ruff check .
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## 🤝 Kontribusi
|
|
422
|
+
|
|
423
|
+
Mau bantu kembangin WattPDL? Baca [`CONTRIBUTING.md`](CONTRIBUTING.md) untuk struktur project dan alur kontribusi.
|
|
424
|
+
|
|
425
|
+
## ❓ FAQ
|
|
426
|
+
|
|
427
|
+
<details>
|
|
428
|
+
<summary><b>Apakah ini legal / aman dipakai?</b></summary>
|
|
429
|
+
|
|
430
|
+
Script ini memakai endpoint publik Wattpad yang sama seperti saat kamu baca cerita lewat browser, jadi tidak meng-hack apa pun. Tapi gunakan secara bertanggung jawab: unduh untuk bacaan pribadi/offline, dan hormati hak cipta penulis. Jangan sebar ulang atau jual isi cerita orang lain.
|
|
431
|
+
|
|
432
|
+
</details>
|
|
433
|
+
|
|
434
|
+
<details>
|
|
435
|
+
<summary><b>Apakah butuh akun Wattpad?</b></summary>
|
|
436
|
+
|
|
437
|
+
Tidak. Tidak perlu login atau API key sama sekali.
|
|
438
|
+
|
|
439
|
+
</details>
|
|
440
|
+
|
|
441
|
+
<details>
|
|
442
|
+
<summary><b>Cerita private / dihapus, bisa diunduh?</b></summary>
|
|
443
|
+
|
|
444
|
+
Tidak. Script hanya bisa mengakses cerita yang memang publik.
|
|
445
|
+
|
|
446
|
+
</details>
|
|
447
|
+
|
|
448
|
+
<details>
|
|
449
|
+
<summary><b>Prosesnya lama, kenapa?</b></summary>
|
|
450
|
+
|
|
451
|
+
Ada jeda 0.5 detik antar chapter (sengaja, biar tidak membebani server Wattpad). Untuk cerita ratusan chapter, wajar kalau prosesnya makan waktu beberapa menit.
|
|
452
|
+
|
|
453
|
+
</details>
|
|
454
|
+
|
|
455
|
+
<details>
|
|
456
|
+
<summary><b>Mode dan format mana yang sebaiknya dipilih?</b></summary>
|
|
457
|
+
|
|
458
|
+
- Mau baca dari awal sampai akhir kayak buku → **Mode 1**, format `.txt` atau `.docx` sama-sama enak
|
|
459
|
+
- Mau tiap chapter jadi file sendiri-sendiri → **Mode 2**
|
|
460
|
+
- Cuma butuh beberapa chapter tertentu (misal lagi ulang baca bagian tertentu) → **Mode 3**
|
|
461
|
+
- Cuma penasaran satu chapter → **Mode 4**
|
|
462
|
+
- Mau edit atau print rapi pakai Word → pilih format **`.docx`**
|
|
463
|
+
- Mau file kecil dan simpel, atau mau dibaca di aplikasi e-reader/notes → pilih format **`.txt`**
|
|
464
|
+
|
|
465
|
+
</details>
|
|
466
|
+
|
|
467
|
+
## 👤 Author
|
|
468
|
+
|
|
469
|
+
<div align="center">
|
|
470
|
+
|
|
471
|
+
| [](https://github.com/nekonaru) |
|
|
472
|
+
|:---:|
|
|
473
|
+
| **Nicolas Dwi Dharma** |
|
|
474
|
+
| [github.com/nekonaru](https://github.com/nekonaru) |
|
|
475
|
+
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
## 📄 License
|
|
479
|
+
|
|
480
|
+
Distributed under the **MIT License**. See [`LICENSE`](LICENSE) for more information.
|
|
481
|
+
|
|
482
|
+
<div align="center">
|
|
483
|
+
|
|
484
|
+
Made with by **Nicolas Dwi Dharma**
|
|
485
|
+
|
|
486
|
+
*Star ⭐ repo ini kalau project ini membantumu!*
|
|
487
|
+
|
|
488
|
+
</div>
|