nhpdf 0.1.0__tar.gz → 1.1__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.
- nhpdf-1.1/LICENSE +21 -0
- nhpdf-1.1/PKG-INFO +166 -0
- nhpdf-1.1/README.md +148 -0
- {nhpdf-0.1.0 → nhpdf-1.1}/pyproject.toml +1 -1
- {nhpdf-0.1.0 → nhpdf-1.1}/src/nhpdf/nhpdf.py +20 -14
- nhpdf-1.1/test.py +40 -0
- nhpdf-0.1.0/LICENSE +0 -0
- nhpdf-0.1.0/PKG-INFO +0 -16
- nhpdf-0.1.0/README.md +0 -0
- nhpdf-0.1.0/requirements.txt +0 -15
- nhpdf-0.1.0/test.py +0 -5
- {nhpdf-0.1.0 → nhpdf-1.1}/.gitignore +0 -0
- {nhpdf-0.1.0 → nhpdf-1.1}/src/nhpdf/__init__.py +0 -0
nhpdf-1.1/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jack Maney
|
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.
|
nhpdf-1.1/PKG-INFO
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: nhpdf
|
3
|
+
Version: 1.1
|
4
|
+
Summary: Download NHentai doujins as PDF
|
5
|
+
Project-URL: Homepage, https://github.com/Aze543/NhentaiDoujinToPDFMaker
|
6
|
+
Project-URL: Issues, https://github.com/Aze543/NhentaiDoujinToPDFMaker/issues
|
7
|
+
Author-email: Aze543 <eizen.9258437663@gmail.com>
|
8
|
+
Maintainer-email: Aze543 <eizen.9258437663@gmail.com>
|
9
|
+
License-Expression: MIT
|
10
|
+
Keywords: goon,pdf,scraper
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
12
|
+
Classifier: Programming Language :: Python
|
13
|
+
Requires-Python: >=3.8
|
14
|
+
Requires-Dist: beautifulsoup4
|
15
|
+
Requires-Dist: img2pdf
|
16
|
+
Requires-Dist: requests
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
|
19
|
+
# NHENTAI DOUJIN-TO-PDF MAKER
|
20
|
+
|
21
|
+
A *disgusting* Python script that compiles doujins from [nhentai.net](https://nhentai.net) into PDFs for **offline gooning**.
|
22
|
+
|
23
|
+
This app has two flavors:
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
## 🧱 Flavor 1: CLI Tool (`nhpdf`)
|
28
|
+
|
29
|
+
A command-line interface you can run from anywhere:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
nhpdf <doujin-code>
|
33
|
+
```
|
34
|
+
|
35
|
+
Example:
|
36
|
+
```bash
|
37
|
+
nhpdf 566212
|
38
|
+
nhpdf 566212 563102 345987
|
39
|
+
```
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
### 🔧 How to Install (CLI Version)
|
44
|
+
|
45
|
+
You can install the CLI tool in two ways:
|
46
|
+
|
47
|
+
#### Option 1: From PyPI
|
48
|
+
|
49
|
+
```bash
|
50
|
+
pip install nhpdf
|
51
|
+
```
|
52
|
+
|
53
|
+
#### Option 2: Locally (Development)
|
54
|
+
|
55
|
+
If you’ve cloned this repo:
|
56
|
+
|
57
|
+
```bash
|
58
|
+
cd NhentaiDoujinToPDFMaker
|
59
|
+
pip install .
|
60
|
+
```
|
61
|
+
|
62
|
+
Now you can run it with:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
nhpdf 566212
|
66
|
+
```
|
67
|
+
|
68
|
+
---
|
69
|
+
|
70
|
+
## 🐍 Flavor 2: Raw Python Script (`main.py`)
|
71
|
+
|
72
|
+
If you prefer to run it like a normal Python script:
|
73
|
+
|
74
|
+
```bash
|
75
|
+
python main.py
|
76
|
+
# or
|
77
|
+
python3 main.py
|
78
|
+
```
|
79
|
+
|
80
|
+
---
|
81
|
+
|
82
|
+
### 📥 How to Set Up (Script Version)
|
83
|
+
|
84
|
+
> These instructions focus on **macOS**, but should work on **Windows** too (with small changes).
|
85
|
+
|
86
|
+
#### 1. Install Python
|
87
|
+
|
88
|
+
Search how to install Python for your OS.
|
89
|
+
|
90
|
+
Check if Python is installed:
|
91
|
+
|
92
|
+
- **Windows**:
|
93
|
+
```bash
|
94
|
+
python
|
95
|
+
```
|
96
|
+
|
97
|
+
- **macOS**:
|
98
|
+
```bash
|
99
|
+
python3
|
100
|
+
```
|
101
|
+
|
102
|
+
You should get a Python REPL (interactive shell).
|
103
|
+
|
104
|
+
---
|
105
|
+
|
106
|
+
#### 2. Install Required Packages
|
107
|
+
|
108
|
+
Navigate to the project directory (where `main.py` and `requirements.txt` live):
|
109
|
+
|
110
|
+
- **Windows**:
|
111
|
+
```bash
|
112
|
+
cd path\to\your\folder
|
113
|
+
dir # list files
|
114
|
+
```
|
115
|
+
|
116
|
+
- **macOS/Linux**:
|
117
|
+
```bash
|
118
|
+
cd /path/to/your/folder
|
119
|
+
ls # list files
|
120
|
+
```
|
121
|
+
|
122
|
+
Then install dependencies:
|
123
|
+
|
124
|
+
```bash
|
125
|
+
pip install -r requirements.txt
|
126
|
+
```
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
#### 3. Run the Script
|
131
|
+
|
132
|
+
```bash
|
133
|
+
python main.py
|
134
|
+
# or
|
135
|
+
python3 main.py
|
136
|
+
```
|
137
|
+
|
138
|
+
You should see:
|
139
|
+
|
140
|
+
```
|
141
|
+
NHENTAI DOUJIN-TO-PDF MAKER
|
142
|
+
```
|
143
|
+
|
144
|
+
✅ You’re good to go!
|
145
|
+
|
146
|
+
---
|
147
|
+
|
148
|
+
## 🧙 How to Use
|
149
|
+
|
150
|
+
Type the code of the nhentai doujin you want, then let the magic happen. The PDF will be saved to your **Documents/nhpdf/** folder.
|
151
|
+
|
152
|
+
---
|
153
|
+
|
154
|
+
> ⚠️ This script only works with [nhentai.net](https://nhentai.net)
|
155
|
+
|
156
|
+
---
|
157
|
+
|
158
|
+
## 🔗 Download
|
159
|
+
|
160
|
+
**GitHub Repo**: [NhentaiDoujinToPDFMaker](https://github.com/Aze543/NhentaiDoujinToPDFMaker)
|
161
|
+
|
162
|
+
You can download either version from the **[Releases](https://github.com/Aze543/NhentaiDoujinToPDFMaker/releases)** page.
|
163
|
+
|
164
|
+
---
|
165
|
+
|
166
|
+
Enjoy responsibly 😅
|
nhpdf-1.1/README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# NHENTAI DOUJIN-TO-PDF MAKER
|
2
|
+
|
3
|
+
A *disgusting* Python script that compiles doujins from [nhentai.net](https://nhentai.net) into PDFs for **offline gooning**.
|
4
|
+
|
5
|
+
This app has two flavors:
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## 🧱 Flavor 1: CLI Tool (`nhpdf`)
|
10
|
+
|
11
|
+
A command-line interface you can run from anywhere:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
nhpdf <doujin-code>
|
15
|
+
```
|
16
|
+
|
17
|
+
Example:
|
18
|
+
```bash
|
19
|
+
nhpdf 566212
|
20
|
+
nhpdf 566212 563102 345987
|
21
|
+
```
|
22
|
+
|
23
|
+
---
|
24
|
+
|
25
|
+
### 🔧 How to Install (CLI Version)
|
26
|
+
|
27
|
+
You can install the CLI tool in two ways:
|
28
|
+
|
29
|
+
#### Option 1: From PyPI
|
30
|
+
|
31
|
+
```bash
|
32
|
+
pip install nhpdf
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Option 2: Locally (Development)
|
36
|
+
|
37
|
+
If you’ve cloned this repo:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
cd NhentaiDoujinToPDFMaker
|
41
|
+
pip install .
|
42
|
+
```
|
43
|
+
|
44
|
+
Now you can run it with:
|
45
|
+
|
46
|
+
```bash
|
47
|
+
nhpdf 566212
|
48
|
+
```
|
49
|
+
|
50
|
+
---
|
51
|
+
|
52
|
+
## 🐍 Flavor 2: Raw Python Script (`main.py`)
|
53
|
+
|
54
|
+
If you prefer to run it like a normal Python script:
|
55
|
+
|
56
|
+
```bash
|
57
|
+
python main.py
|
58
|
+
# or
|
59
|
+
python3 main.py
|
60
|
+
```
|
61
|
+
|
62
|
+
---
|
63
|
+
|
64
|
+
### 📥 How to Set Up (Script Version)
|
65
|
+
|
66
|
+
> These instructions focus on **macOS**, but should work on **Windows** too (with small changes).
|
67
|
+
|
68
|
+
#### 1. Install Python
|
69
|
+
|
70
|
+
Search how to install Python for your OS.
|
71
|
+
|
72
|
+
Check if Python is installed:
|
73
|
+
|
74
|
+
- **Windows**:
|
75
|
+
```bash
|
76
|
+
python
|
77
|
+
```
|
78
|
+
|
79
|
+
- **macOS**:
|
80
|
+
```bash
|
81
|
+
python3
|
82
|
+
```
|
83
|
+
|
84
|
+
You should get a Python REPL (interactive shell).
|
85
|
+
|
86
|
+
---
|
87
|
+
|
88
|
+
#### 2. Install Required Packages
|
89
|
+
|
90
|
+
Navigate to the project directory (where `main.py` and `requirements.txt` live):
|
91
|
+
|
92
|
+
- **Windows**:
|
93
|
+
```bash
|
94
|
+
cd path\to\your\folder
|
95
|
+
dir # list files
|
96
|
+
```
|
97
|
+
|
98
|
+
- **macOS/Linux**:
|
99
|
+
```bash
|
100
|
+
cd /path/to/your/folder
|
101
|
+
ls # list files
|
102
|
+
```
|
103
|
+
|
104
|
+
Then install dependencies:
|
105
|
+
|
106
|
+
```bash
|
107
|
+
pip install -r requirements.txt
|
108
|
+
```
|
109
|
+
|
110
|
+
---
|
111
|
+
|
112
|
+
#### 3. Run the Script
|
113
|
+
|
114
|
+
```bash
|
115
|
+
python main.py
|
116
|
+
# or
|
117
|
+
python3 main.py
|
118
|
+
```
|
119
|
+
|
120
|
+
You should see:
|
121
|
+
|
122
|
+
```
|
123
|
+
NHENTAI DOUJIN-TO-PDF MAKER
|
124
|
+
```
|
125
|
+
|
126
|
+
✅ You’re good to go!
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
## 🧙 How to Use
|
131
|
+
|
132
|
+
Type the code of the nhentai doujin you want, then let the magic happen. The PDF will be saved to your **Documents/nhpdf/** folder.
|
133
|
+
|
134
|
+
---
|
135
|
+
|
136
|
+
> ⚠️ This script only works with [nhentai.net](https://nhentai.net)
|
137
|
+
|
138
|
+
---
|
139
|
+
|
140
|
+
## 🔗 Download
|
141
|
+
|
142
|
+
**GitHub Repo**: [NhentaiDoujinToPDFMaker](https://github.com/Aze543/NhentaiDoujinToPDFMaker)
|
143
|
+
|
144
|
+
You can download either version from the **[Releases](https://github.com/Aze543/NhentaiDoujinToPDFMaker/releases)** page.
|
145
|
+
|
146
|
+
---
|
147
|
+
|
148
|
+
Enjoy responsibly 😅
|
@@ -2,37 +2,42 @@ import img2pdf # type: ignore
|
|
2
2
|
import requests
|
3
3
|
from typing import NoReturn
|
4
4
|
from bs4 import BeautifulSoup
|
5
|
+
from concurrent.futures import ThreadPoolExecutor
|
5
6
|
import re
|
6
7
|
import sys
|
7
8
|
import time
|
8
9
|
import threading
|
9
10
|
from pathlib import Path
|
11
|
+
from math import trunc
|
10
12
|
|
11
13
|
nhpdf_dir = Path.home()/"Documents"/"nhpdf"
|
12
14
|
nhpdf_dir.mkdir(parents=True, exist_ok=True)
|
13
15
|
|
14
|
-
def loading_animation():
|
16
|
+
def loading_animation() -> NoReturn:
|
15
17
|
global la, pages, page
|
16
18
|
spinner = ['|', '/', '-', '\\']
|
17
19
|
while not la:
|
18
20
|
for frame in spinner:
|
19
|
-
sys.stdout.write(f'\rDownloading the pages ({page
|
21
|
+
sys.stdout.write(f'\rDownloading the pages ({trunc((page/pages)*100)}%/{100}%)...{frame}')
|
20
22
|
sys.stdout.flush()
|
21
23
|
time.sleep(0.1)
|
22
24
|
if la:
|
23
25
|
break
|
24
|
-
|
25
|
-
def
|
26
|
+
|
27
|
+
def download_image(raw_url: str) -> bytes:
|
26
28
|
global pages, page
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
response
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
page += 1
|
30
|
+
img_code, f_type = re.search(r'/(\d+)', raw_url['data-src']).group(), re.search(r'\b(.(jpg|jpeg|png|webp))\b', raw_url['data-src']).group()
|
31
|
+
url = f'https://i3.nhentai.net/galleries{img_code}/{page}{f_type}'
|
32
|
+
response = requests.get(url)
|
33
|
+
if response.status_code == 200:
|
34
|
+
return response.content
|
35
|
+
return None
|
36
|
+
|
37
|
+
|
38
|
+
def compile_images(raw: list, name: str) -> NoReturn:
|
39
|
+
with ThreadPoolExecutor(max_workers=10) as executor:
|
40
|
+
raw_images = list(executor.map(download_image, raw))
|
36
41
|
nhpdf = nhpdf_dir/f"{name}.pdf"
|
37
42
|
with open(nhpdf, "wb") as file:
|
38
43
|
file.write(img2pdf.convert(raw_images))
|
@@ -68,9 +73,10 @@ def start_nhpdf():
|
|
68
73
|
print("\n[ERROR]: The code cannot be found in the website.\n\ngoing to the next code...")
|
69
74
|
continue
|
70
75
|
print(f"\nH-Doujin Details:\nname: {name}\nauthor: {author}\npages: {pages}\n")
|
76
|
+
raw_data.remove(raw_data[0])
|
71
77
|
function_thread = threading.Thread(target=loading_animation)
|
72
78
|
function_thread.start()
|
73
|
-
compile_images(raw_data, name)
|
79
|
+
compile_images(raw_data[:pages], name)
|
74
80
|
la = True
|
75
81
|
function_thread.join()
|
76
82
|
if item != items:
|
nhpdf-1.1/test.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import requests
|
2
|
+
from concurrent.futures import ThreadPoolExecutor
|
3
|
+
import time
|
4
|
+
import img2pdf
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
def download_image(url):
|
11
|
+
response = requests.get(url)
|
12
|
+
if response.status_code == 200:
|
13
|
+
return response.content # or save to file here
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
image_urls = [
|
20
|
+
"https://i3.nhentai.net/galleries/3311475/1.webp",
|
21
|
+
"https://i3.nhentai.net/galleries/3311475/2.webp",
|
22
|
+
"https://i3.nhentai.net/galleries/3311475/3.webp",
|
23
|
+
"https://i3.nhentai.net/galleries/3311475/4.webp",
|
24
|
+
"https://i3.nhentai.net/galleries/3311475/5.webp",
|
25
|
+
"https://i3.nhentai.net/galleries/3311475/6.webp",
|
26
|
+
"https://i3.nhentai.net/galleries/3311475/7.webp",
|
27
|
+
"https://i3.nhentai.net/galleries/3311475/8.webp",
|
28
|
+
"https://i3.nhentai.net/galleries/3311475/9.webp",
|
29
|
+
"https://i3.nhentai.net/galleries/3311475/10.webp",
|
30
|
+
"https://i3.nhentai.net/galleries/3311475/11.webp",
|
31
|
+
"https://i3.nhentai.net/galleries/3311475/12.webp",
|
32
|
+
"https://i3.nhentai.net/galleries/3311475/13.webp",
|
33
|
+
"https://i3.nhentai.net/galleries/3285893/21.jpg",
|
34
|
+
]
|
35
|
+
|
36
|
+
with ThreadPoolExecutor(max_workers=10) as executor:
|
37
|
+
results = list(executor.map(download_image, image_urls))
|
38
|
+
|
39
|
+
with open("test.pdf", "wb") as file:
|
40
|
+
file.write(img2pdf.convert(results))
|
nhpdf-0.1.0/LICENSE
DELETED
File without changes
|
nhpdf-0.1.0/PKG-INFO
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: nhpdf
|
3
|
-
Version: 0.1.0
|
4
|
-
Summary: Download NHentai doujins as PDF
|
5
|
-
Project-URL: Homepage, https://github.com/Aze543/NhentaiDoujinToPDFMaker
|
6
|
-
Project-URL: Issues, https://github.com/Aze543/NhentaiDoujinToPDFMaker/issues
|
7
|
-
Author-email: Aze543 <eizen.9258437663@gmail.com>
|
8
|
-
Maintainer-email: Aze543 <eizen.9258437663@gmail.com>
|
9
|
-
License-Expression: MIT
|
10
|
-
Keywords: goon,pdf,scraper
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
12
|
-
Classifier: Programming Language :: Python
|
13
|
-
Requires-Python: >=3.8
|
14
|
-
Requires-Dist: beautifulsoup4
|
15
|
-
Requires-Dist: img2pdf
|
16
|
-
Requires-Dist: requests
|
nhpdf-0.1.0/README.md
DELETED
File without changes
|
nhpdf-0.1.0/requirements.txt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
beautifulsoup4==4.13.3
|
2
|
-
certifi==2025.1.31
|
3
|
-
charset-normalizer==3.4.1
|
4
|
-
Deprecated==1.2.18
|
5
|
-
idna==3.10
|
6
|
-
img2pdf==0.6.0
|
7
|
-
lxml==5.3.2
|
8
|
-
packaging==24.2
|
9
|
-
pikepdf==9.7.0
|
10
|
-
pillow==11.1.0
|
11
|
-
requests==2.32.3
|
12
|
-
soupsieve==2.6
|
13
|
-
typing_extensions==4.13.1
|
14
|
-
urllib3==2.3.0
|
15
|
-
wrapt==1.17.2
|
nhpdf-0.1.0/test.py
DELETED
File without changes
|
File without changes
|