ehentai 0.2.2__py2.py3-none-any.whl → 0.2.3__py2.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.
- ehentai/__version__.py +1 -1
- ehentai/connect.py +10 -6
- ehentai/eh.py +1 -15
- ehentai/utils.py +28 -0
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/METADATA +1 -1
- ehentai-0.2.3.dist-info/RECORD +15 -0
- ehentai-0.2.2.dist-info/RECORD +0 -14
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/WHEEL +0 -0
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/entry_points.txt +0 -0
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/licenses/LICENSE +0 -0
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/licenses/NOTICE +0 -0
- {ehentai-0.2.2.dist-info → ehentai-0.2.3.dist-info}/top_level.txt +0 -0
ehentai/__version__.py
CHANGED
ehentai/connect.py
CHANGED
@@ -15,7 +15,7 @@ headers={
|
|
15
15
|
|
16
16
|
hosts=["104.20.19.168", "172.67.2.238", "104.20.18.168"]
|
17
17
|
|
18
|
-
def get_response(url: str,direct: bool=False,hosts=hosts,headers=headers,params=None,**args)->requests.Response:
|
18
|
+
def get_response(url: str,direct: bool=False,hosts=hosts,headers=headers,params=None,timeout=6.1,**args)->requests.Response:
|
19
19
|
|
20
20
|
if not direct:
|
21
21
|
for ip in hosts:
|
@@ -30,6 +30,7 @@ def get_response(url: str,direct: bool=False,hosts=hosts,headers=headers,params=
|
|
30
30
|
impersonate="chrome",
|
31
31
|
headers=headers,
|
32
32
|
verify=False,
|
33
|
+
timeout=timeout,
|
33
34
|
**args,
|
34
35
|
)
|
35
36
|
|
@@ -37,15 +38,18 @@ def get_response(url: str,direct: bool=False,hosts=hosts,headers=headers,params=
|
|
37
38
|
return response
|
38
39
|
except requests.exceptions.ConnectionError as e:
|
39
40
|
time.sleep(1)
|
40
|
-
print("fetch again..")
|
41
|
+
print("fetch again..",type(e))
|
42
|
+
except requests.exceptions.RequestException as e:
|
43
|
+
time.sleep(1)
|
44
|
+
print("fetch again..",type(e))
|
41
45
|
except requests.exceptions.ReadTimeout as e:
|
42
46
|
time.sleep(1)
|
43
|
-
print("fetch again..")
|
47
|
+
print("fetch again..",type(e))
|
44
48
|
except Exception as e:
|
45
49
|
time.sleep(1)
|
46
|
-
print("fetch again..")
|
50
|
+
print("fetch again..",type(e))
|
47
51
|
|
48
|
-
return requests.get(url,params=params,headers=headers,impersonate="chrome",timeout=
|
52
|
+
return requests.get(url,params=params,headers=headers,impersonate="chrome",timeout=timeout,**args)
|
49
53
|
|
50
54
|
def keyword(
|
51
55
|
f_search: str = None,
|
@@ -94,9 +98,9 @@ def next_view(sp: BeautifulSoup):
|
|
94
98
|
# url:target_URL
|
95
99
|
# parms:search_keyword
|
96
100
|
def get_sp(url: str,params=None,encoding=None,direct=False)->BeautifulSoup:
|
97
|
-
# set encoding
|
98
101
|
response=get_response(url,direct,params=params)
|
99
102
|
|
103
|
+
# set encoding
|
100
104
|
if encoding:
|
101
105
|
response.encoding=encoding
|
102
106
|
|
ehentai/eh.py
CHANGED
@@ -8,11 +8,7 @@ from typing import List
|
|
8
8
|
from ehentai.conf import *
|
9
9
|
from ehentai import __version__
|
10
10
|
from ehentai import Page,Gallery,get_search,get_popular
|
11
|
-
|
12
|
-
HOME=os.path.abspath(os.path.join(os.getenv('HOME'),".hentai"))
|
13
|
-
|
14
|
-
if not os.path.exists(HOME):
|
15
|
-
os.makedirs(HOME)
|
11
|
+
from ehentai.utils import save_json,load_json
|
16
12
|
|
17
13
|
def echo_gl_table(detail=False,gl_table: List[Gallery]=None):
|
18
14
|
if gl_table:
|
@@ -26,16 +22,6 @@ def echo_gl_table(detail=False,gl_table: List[Gallery]=None):
|
|
26
22
|
echo("Page's Gallery Table is None.")
|
27
23
|
|
28
24
|
|
29
|
-
def save_json(filename: str,data: object):
|
30
|
-
with open(os.path.join(HOME,filename),"w") as f:
|
31
|
-
f.write(json.dumps(data,default=lambda obj:obj.__dict__))
|
32
|
-
def load_json(filename: str,data_type):
|
33
|
-
with open(os.path.join(HOME,filename),"r") as f:
|
34
|
-
return data_type(**json.loads(f.read()))
|
35
|
-
|
36
|
-
page: Page
|
37
|
-
|
38
|
-
|
39
25
|
@click.group()
|
40
26
|
def cli():
|
41
27
|
pass
|
ehentai/utils.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import json
|
2
|
+
import os
|
3
|
+
from PIL import Image
|
4
|
+
import platform
|
5
|
+
|
6
|
+
# home path
|
7
|
+
HOME:str
|
8
|
+
match platform.system():
|
9
|
+
case 'Windows':HOME=os.path.abspath(os.path.join(os.getenv('HOMEPATH'),".hentai"))
|
10
|
+
case _:HOME=os.path.abspath(os.path.join(os.getenv('HOME'),".hentai"))
|
11
|
+
|
12
|
+
# json data
|
13
|
+
if not os.path.exists(HOME):
|
14
|
+
os.makedirs(HOME)
|
15
|
+
def save_json(filename: str,data: object):
|
16
|
+
with open(os.path.join(HOME,filename),"w") as f:
|
17
|
+
f.write(json.dumps(data,default=lambda obj:obj.__dict__))
|
18
|
+
def load_json(filename: str,data_type):
|
19
|
+
with open(os.path.join(HOME,filename),"r") as f:
|
20
|
+
return data_type(**json.loads(f.read()))
|
21
|
+
|
22
|
+
# args:list[Image]
|
23
|
+
def merge_img():
|
24
|
+
pass
|
25
|
+
|
26
|
+
# args:list[Image]
|
27
|
+
def img2pdf():
|
28
|
+
pass
|
@@ -0,0 +1,15 @@
|
|
1
|
+
ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
|
2
|
+
ehentai/__version__.py,sha256=rqpPrT4Y3eMAcfDqfstGBzzIbei-vK0ENoNe8H4mBUg,1012
|
3
|
+
ehentai/api.py,sha256=IGCwJiGgQBu9Q0XNJb4_vbNsO7VPOzx31KkqQC2FmtI,1123
|
4
|
+
ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
|
5
|
+
ehentai/connect.py,sha256=F-TQNrKvTpR1vu4XyP8IlLRu8z8XwMteC-Mts0breVk,3846
|
6
|
+
ehentai/eh.py,sha256=CcseQ1nXdjkjAwlcvCJpWE_pGAMVDJbaJcSJDxeWOZ8,4224
|
7
|
+
ehentai/fetch.py,sha256=UxBFd8FpKXQ3KO746IpA7p3o8B0T7PKDt8ZLpoQ3Zo8,5171
|
8
|
+
ehentai/utils.py,sha256=KP0O7zGJl7_gBz5II5Ls5KQljk2v6Q6SL_uggw6sCs8,727
|
9
|
+
ehentai-0.2.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
10
|
+
ehentai-0.2.3.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
|
11
|
+
ehentai-0.2.3.dist-info/METADATA,sha256=OxdQPeBFJ-AZVArBrpyxOaoZ9m4WnkJ7JJa7US_cFPs,606
|
12
|
+
ehentai-0.2.3.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
13
|
+
ehentai-0.2.3.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
|
14
|
+
ehentai-0.2.3.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
|
15
|
+
ehentai-0.2.3.dist-info/RECORD,,
|
ehentai-0.2.2.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
|
2
|
-
ehentai/__version__.py,sha256=kgvFd5p-NAoTPoLjOlA4IFV8peVOaT53_w6zhX5i8sQ,1012
|
3
|
-
ehentai/api.py,sha256=IGCwJiGgQBu9Q0XNJb4_vbNsO7VPOzx31KkqQC2FmtI,1123
|
4
|
-
ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
|
5
|
-
ehentai/connect.py,sha256=AdmYBewqvCSMs-satHwB33BGbZOaYAmxq9M762NK5ss,3632
|
6
|
-
ehentai/eh.py,sha256=Ju4jgWXaoRf_XzlzwJh_14SlPpVRNZ1L4DMnWBk0nbY,4613
|
7
|
-
ehentai/fetch.py,sha256=UxBFd8FpKXQ3KO746IpA7p3o8B0T7PKDt8ZLpoQ3Zo8,5171
|
8
|
-
ehentai-0.2.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
9
|
-
ehentai-0.2.2.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
|
10
|
-
ehentai-0.2.2.dist-info/METADATA,sha256=VuIX9XRzY1zRJWjXS6Cghfc4GhcqoMGY5sUEqpU8Woc,606
|
11
|
-
ehentai-0.2.2.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
12
|
-
ehentai-0.2.2.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
|
13
|
-
ehentai-0.2.2.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
|
14
|
-
ehentai-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|