nhpdf 1.7__py3-none-any.whl → 1.8__py3-none-any.whl
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/nhpdf.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import img2pdf
|
|
2
|
-
import
|
|
1
|
+
import img2pdf
|
|
2
|
+
import cloudscraper
|
|
3
3
|
from typing import NoReturn
|
|
4
4
|
from bs4 import BeautifulSoup
|
|
5
5
|
from concurrent.futures import ThreadPoolExecutor
|
|
@@ -15,6 +15,13 @@ from PIL import Image
|
|
|
15
15
|
nhpdf_dir = Path.home()/"Documents"/"nhpdf"
|
|
16
16
|
nhpdf_dir.mkdir(parents=True, exist_ok=True)
|
|
17
17
|
|
|
18
|
+
scraper = cloudscraper.create_scraper(
|
|
19
|
+
browser={
|
|
20
|
+
"browser": "chrome",
|
|
21
|
+
"platform": "windows",
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
|
|
18
25
|
def loading_animation() -> NoReturn:
|
|
19
26
|
global la, pages, page
|
|
20
27
|
spinner = ['|', '/', '-', '\\']
|
|
@@ -33,7 +40,7 @@ def download_image(raw_url: str) -> bytes:
|
|
|
33
40
|
page += 1
|
|
34
41
|
img_code, f_type = re.search(r'/(\d+)', raw_url['data-src']).group(), re.search(r'\b(.(jpg|jpeg|png|webp|gif|tiff|svg))\b', raw_url['data-src']).group()
|
|
35
42
|
url = f'https://i3.nhentai.net/galleries{img_code}/{page}{f_type}'
|
|
36
|
-
response =
|
|
43
|
+
response = scraper.get(url)
|
|
37
44
|
if response.status_code == 200:
|
|
38
45
|
content = check_alpha(response.content)
|
|
39
46
|
return content
|
|
@@ -51,7 +58,7 @@ def compile_images(raw: list, name: str) -> NoReturn:
|
|
|
51
58
|
def check_alpha(image: bytes) -> bytes:
|
|
52
59
|
try:
|
|
53
60
|
img2pdf.convert(image)
|
|
54
|
-
except img2pdf.AlphaChannelError
|
|
61
|
+
except img2pdf.AlphaChannelError:
|
|
55
62
|
buffered = io.BytesIO(image)
|
|
56
63
|
img = Image.open(buffered)
|
|
57
64
|
converted: Image = img.convert('RGB')
|
|
@@ -79,7 +86,7 @@ def start_nhpdf():
|
|
|
79
86
|
print("\nThe code needs to be numbers (Ex: 177013) :) \n\ngoing to the next code...")
|
|
80
87
|
continue
|
|
81
88
|
url = f'https://nhentai.net/g/{code}/'
|
|
82
|
-
response =
|
|
89
|
+
response = scraper.get(url)
|
|
83
90
|
try:
|
|
84
91
|
soup = BeautifulSoup(response.text, "html.parser")
|
|
85
92
|
pages = len(soup.find_all(class_='gallerythumb'))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nhpdf
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8
|
|
4
4
|
Summary: Download NHentai doujins as PDF
|
|
5
5
|
Project-URL: Homepage, https://github.com/Aze543/NhentaiDoujinToPDFMaker
|
|
6
6
|
Project-URL: Issues, https://github.com/Aze543/NhentaiDoujinToPDFMaker/issues
|
|
@@ -12,6 +12,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Requires-Python: >=3.8
|
|
14
14
|
Requires-Dist: beautifulsoup4
|
|
15
|
+
Requires-Dist: cloudscraper
|
|
15
16
|
Requires-Dist: img2pdf
|
|
16
17
|
Requires-Dist: requests
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
nhpdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
nhpdf/nhpdf.py,sha256=JecJnkqs_vqf9kekuXXDzlawfbo-kcgKw9HjtyECx7M,3853
|
|
3
|
+
nhpdf-1.8.dist-info/METADATA,sha256=hK6ndatQvzByFGN12DAIjltPsE0N9_oFaRFe51Od6QA,2901
|
|
4
|
+
nhpdf-1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
nhpdf-1.8.dist-info/entry_points.txt,sha256=Dn0ISURSvQrGZMCOxYEA5ocSWU5DUOiT50J7FHZk5Xs,50
|
|
6
|
+
nhpdf-1.8.dist-info/RECORD,,
|
nhpdf-1.7.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
nhpdf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
nhpdf/nhpdf.py,sha256=YQl9bsXDgv7uJTpW_iiCRDFyRahJYVPKvscbtKC-sgs,3758
|
|
3
|
-
nhpdf-1.7.dist-info/METADATA,sha256=NbXvJvEAQTbGQsxL3Ok6vyeQTlXStb9Nkzvsxu7RDMw,2873
|
|
4
|
-
nhpdf-1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
-
nhpdf-1.7.dist-info/entry_points.txt,sha256=Dn0ISURSvQrGZMCOxYEA5ocSWU5DUOiT50J7FHZk5Xs,50
|
|
6
|
-
nhpdf-1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|