ehentai 0.2__py2.py3-none-any.whl → 0.2.1__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/api.py +1 -1
- ehentai/connect.py +120 -0
- ehentai/fetch.py +1 -1
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/METADATA +1 -1
- ehentai-0.2.1.dist-info/RECORD +14 -0
- ehentai-0.2.dist-info/RECORD +0 -13
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/WHEEL +0 -0
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/entry_points.txt +0 -0
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/licenses/LICENSE +0 -0
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/licenses/NOTICE +0 -0
- {ehentai-0.2.dist-info → ehentai-0.2.1.dist-info}/top_level.txt +0 -0
ehentai/__version__.py
CHANGED
ehentai/api.py
CHANGED
ehentai/connect.py
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
from bs4 import BeautifulSoup
|
2
|
+
import time
|
3
|
+
from ehentai.conf import CATS
|
4
|
+
from curl_cffi import requests
|
5
|
+
|
6
|
+
DOMAIN="e-hentai.org"
|
7
|
+
URL="https://e-hentai.org"
|
8
|
+
|
9
|
+
headers={
|
10
|
+
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
11
|
+
"Referer":"http://www.google.com",
|
12
|
+
}
|
13
|
+
|
14
|
+
hosts=["104.20.19.168", "172.67.2.238", "104.20.18.168"]
|
15
|
+
|
16
|
+
def get_response(url: str,direct: bool=False,hosts=hosts,headers=headers,params=None,**args)->requests.Response:
|
17
|
+
|
18
|
+
if not direct:
|
19
|
+
for ip in hosts:
|
20
|
+
if url.find(DOMAIN)!=-1:
|
21
|
+
headers['Host']=DOMAIN
|
22
|
+
url=url[:url.find(DOMAIN)]+ip+url[url.find(DOMAIN)+len(DOMAIN):]
|
23
|
+
try:
|
24
|
+
print(url)
|
25
|
+
response = requests.get(
|
26
|
+
url,
|
27
|
+
params=params,
|
28
|
+
impersonate="chrome",
|
29
|
+
headers=headers,
|
30
|
+
verify=False,
|
31
|
+
**args,
|
32
|
+
)
|
33
|
+
|
34
|
+
if response.ok:
|
35
|
+
return response
|
36
|
+
except requests.exceptions.ConnectionError as e:
|
37
|
+
time.sleep(1)
|
38
|
+
print("fetch again..")
|
39
|
+
except requests.exceptions.ReadTimeout as e:
|
40
|
+
time.sleep(1)
|
41
|
+
print("fetch again..")
|
42
|
+
except Exception as e:
|
43
|
+
time.sleep(1)
|
44
|
+
print("fetch again..")
|
45
|
+
|
46
|
+
return requests.get(url,params=params,headers=headers,impersonate="chrome",timeout=27.03,**args)
|
47
|
+
|
48
|
+
def keyword(
|
49
|
+
f_search: str = None,
|
50
|
+
f_cats: int = None,
|
51
|
+
advsearch: bool = None,
|
52
|
+
f_sh: bool = None,
|
53
|
+
f_sto: bool = None,
|
54
|
+
f_spf: int = None,
|
55
|
+
f_spt: int = None,
|
56
|
+
f_srdd: int = None,
|
57
|
+
f_sfl: bool = None,
|
58
|
+
f_sfu: bool = None,
|
59
|
+
f_sft: bool = None,
|
60
|
+
cats_list=None
|
61
|
+
):
|
62
|
+
kw={}
|
63
|
+
# search_kw
|
64
|
+
kw["f_search"]=f_search
|
65
|
+
# category
|
66
|
+
if f_cats or cats_list:kw["f_cats"]=get_f_cats(f_cats,cats_list),
|
67
|
+
# advanced search
|
68
|
+
# show advanced options
|
69
|
+
if advsearch or f_sh or f_sto or f_spf or f_spt or f_srdd or f_sfl or f_sfu or f_sft:kw["advsearch"]=1
|
70
|
+
# show expunged galleries
|
71
|
+
if f_sh:kw["f_sh"]="on"
|
72
|
+
# require Gallery torrent
|
73
|
+
if f_sto:kw["f_sto"]="on"
|
74
|
+
# between {f_spf} and {f_spt} Pages
|
75
|
+
if f_spf:kw["f_spf"]=f_spf,
|
76
|
+
if f_spt:kw["f_spt"]=f_spt,
|
77
|
+
# minimum_rating
|
78
|
+
if f_srdd:kw["f_srdd"]=f_srdd,
|
79
|
+
# disable filter language
|
80
|
+
if f_sfl:kw["f_sfl"]="on"
|
81
|
+
# disable filter uploader
|
82
|
+
if f_sfu:kw["f_sfu"]="on"
|
83
|
+
# disable filter tags
|
84
|
+
if f_sft:kw["f_sft"]="on"
|
85
|
+
|
86
|
+
return kw
|
87
|
+
|
88
|
+
|
89
|
+
def next_view(sp: BeautifulSoup):
|
90
|
+
return sp.find('table',class_="ptt").find_all('td')[-1].find('a')
|
91
|
+
|
92
|
+
# url:target_URL
|
93
|
+
# parms:search_keyword
|
94
|
+
def get_sp(url: str,params=None,encoding=None,direct=False)->BeautifulSoup:
|
95
|
+
# set encoding
|
96
|
+
response=get_response(url,direct,params=params)
|
97
|
+
|
98
|
+
if encoding:
|
99
|
+
response.encoding=encoding
|
100
|
+
|
101
|
+
# response info
|
102
|
+
# print(response.encoding)
|
103
|
+
# print(response.url)
|
104
|
+
|
105
|
+
return BeautifulSoup(response.text,"lxml")
|
106
|
+
|
107
|
+
|
108
|
+
# switch categories: doujinshi...
|
109
|
+
def get_f_cats(cat_code=None,cats: list=None):
|
110
|
+
cat_code=cat_code if cat_code else 0b0011111111
|
111
|
+
res=0b1111111111
|
112
|
+
if cats:
|
113
|
+
for v in list(i.value for i in cats):
|
114
|
+
res&=v
|
115
|
+
return res
|
116
|
+
|
117
|
+
for v in list(i.value for i in CATS):
|
118
|
+
if cat_code&1:res&=v
|
119
|
+
cat_code>>=1
|
120
|
+
return res
|
ehentai/fetch.py
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
|
2
|
+
ehentai/__version__.py,sha256=tEY2wJZdUS7tYb5RmztuKRSgueXqaNjuVbuxO-E1h0A,1012
|
3
|
+
ehentai/api.py,sha256=pSZUt_tYSyKz4HLVAvfrrNilRWjUnh7qIaLUTjUPruw,1115
|
4
|
+
ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
|
5
|
+
ehentai/connect.py,sha256=65ZXrWIZkBk6IhMqBHpXKMJmR5L2ARFZGCTrNhEESbQ,3467
|
6
|
+
ehentai/eh.py,sha256=bkwYJF3mW1Vk5WxupvREWp0imKWTXSdH356aQBr5uBo,4485
|
7
|
+
ehentai/fetch.py,sha256=UsSKZLem3RwCsPJi4KO5sRnHjK6TYpDzD6UZJ0_j3EY,4975
|
8
|
+
ehentai-0.2.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
9
|
+
ehentai-0.2.1.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
|
10
|
+
ehentai-0.2.1.dist-info/METADATA,sha256=7CaX-ZL_IcECJZlBaOfONVDyPDvVTwr2R8Vm9TtBG_E,606
|
11
|
+
ehentai-0.2.1.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
12
|
+
ehentai-0.2.1.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
|
13
|
+
ehentai-0.2.1.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
|
14
|
+
ehentai-0.2.1.dist-info/RECORD,,
|
ehentai-0.2.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
ehentai/__init__.py,sha256=2nj4ZQ3qwERHMUCSE1S0I3wy0mDkCNwCxeSFk-QMZo4,52
|
2
|
-
ehentai/__version__.py,sha256=ItZgDjKTDWKAb-z5rJ4jLukDnSFQ7Ep6F-6NImOEqJk,1010
|
3
|
-
ehentai/api.py,sha256=zTPygliwFDJ4AxHg1OQgKGWXlEevyTOBiTBObi4aCBE,1121
|
4
|
-
ehentai/conf.py,sha256=_58VU-o5T4k7X1bHLNp_iZXimj9T-JOYYP6PPmeIaFA,1115
|
5
|
-
ehentai/eh.py,sha256=bkwYJF3mW1Vk5WxupvREWp0imKWTXSdH356aQBr5uBo,4485
|
6
|
-
ehentai/fetch.py,sha256=IZDVdnV2aMnUszd0S0e_H2yerc8oP_XFLopo7q-ulBo,4981
|
7
|
-
ehentai-0.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
8
|
-
ehentai-0.2.dist-info/licenses/NOTICE,sha256=mTsYLHfcXGcFMSSdkQX-LbKWxxieIA2L4sMNXitGN4k,30
|
9
|
-
ehentai-0.2.dist-info/METADATA,sha256=nkW-443IMUDLEZrNHnC90rc-ujDhwzSMJ-1fAgyLN1M,604
|
10
|
-
ehentai-0.2.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
11
|
-
ehentai-0.2.dist-info/entry_points.txt,sha256=lc9qUbtXSHccaXX_CLtlh605pt2r3zfw6Lbuem3mQO8,38
|
12
|
-
ehentai-0.2.dist-info/top_level.txt,sha256=NzB7Gi8Sxv8D3VNP4b9wiNdC-zQ4yntM0Uo9TAXnScE,8
|
13
|
-
ehentai-0.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|