Demo
import asyncio
from loguru import logger
from PicImageSearch import EHentai, Network
from PicImageSearch.model import EHentaiResponse
proxies = "http://127.0.0.1:1081"
# proxies = None
file_path = r"images/test06.jpg" # 搜索本地图片
cookies = None # 注意:如果要使用 EXHentai 搜索,需要提供 cookies
ex = False # 是否使用 EXHentai 搜索
@logger.catch()
async def test() -> None:
async with Network(proxies=proxies, cookies=cookies) as client:
ehentai = EHentai(client=client)
resp = await ehentai.search(file_path, ex=ex)
show_result(resp)
def show_result(resp: EHentaiResponse) -> None:
# logger.info(resp.origin) # 原始数据
logger.info(resp.url) # 搜索结果链接
# logger.info(resp.raw[0].origin)
logger.info(resp.raw[0].title)
logger.info(resp.raw[0].url)
logger.info(resp.raw[0].thumbnail)
logger.info(resp.raw[0].type)
logger.info(resp.raw[0].date)
logger.info(resp.raw[0].tags)
logger.info("-" * 50)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(test())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from loguru import logger
from PicImageSearch.model import EHentaiResponse
from PicImageSearch.sync import EHentai as EHentaiSync
proxies = "http://127.0.0.1:1081"
# proxies = None
file_path = r"images/test06.jpg" # 搜索本地图片
cookies = None # 注意:如果要使用 EXHentai 搜索,需要提供 cookies
ex = False # 是否使用 EXHentai 搜索
@logger.catch()
def test_sync() -> None:
ehentai = EHentaiSync(proxies=proxies, cookies=cookies)
resp = ehentai.search(file_path, ex=ex)
show_result(resp)
def show_result(resp: EHentaiResponse) -> None:
# logger.info(resp.origin) # 原始数据
logger.info(resp.url) # 搜索结果链接
# logger.info(resp.raw[0].origin)
logger.info(resp.raw[0].title)
logger.info(resp.raw[0].url)
logger.info(resp.raw[0].thumbnail)
logger.info(resp.raw[0].type)
logger.info(resp.raw[0].date)
logger.info(resp.raw[0].tags)
logger.info("-" * 50)
if __name__ == "__main__":
test_sync()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Make sure to add code blocks to your code group
⚠注意
E-Hentai
与ExHentai
不支持单色图片
的搜索,例如黑白漫画
只推荐用于搜索CG
、画集
、图集
、彩色漫画
、彩色封面
等
- name: 前往查看
desc: 🚀测试文件Demo
link: https://github.com/kitUIN/PicImageSearch/blob/main/demo/demo_ehentai.py
bgColor: '#DFEEE7'
textColor: '#2A3344'
1
2
3
4
5
2
3
4
5
2022-03-27 19:52:16.097 | INFO | PicImageSearch.ehentai:search:38 - Headers({'date': 'Sun, 27 Mar 2022 11:52:14 GMT', 'content-type': 'text/html; charset=UTF-8', 'content-length': '3644', 'connection': 'keep-alive', 'cache-control': 'no-cache', 'mixed-content': 'noupgrade', 'vary': 'Accept-Encoding', 'content-encoding': 'gzip', 'x-varnish': '149286630', 'age': '0', 'via': '1.1 varnish (Varnish/6.0)', 'accept-ranges': 'bytes', 'strict-transport-security': 'max-age=31536000; preload;', 'cf-cache-status': 'DYNAMIC', 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'server': 'cloudflare', 'cf-ray': '6f27eb311fe33107-LAX'})
2022-03-27 19:52:16.098 | INFO | PicImageSearch.ehentai:search:39 - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">...
2022-03-27 19:52:16.115 | INFO | __main__:show_result:38 - https://e-hentai.org/?f_shash=2b678c36f666bf7037146fb377ffd9384505af8b;e6eb91d1bf73e0c367188fd7a0b0f7c9757addfc;bb9f35a23e1fe20949a7bc5eb605db9dc25e3758&fs_from=test06.jpg&fs_similar=on
2022-03-27 19:52:16.115 | INFO | __main__:show_result:40 - [MIGNON WORKS (mignon)] Heso Dashi Look [Chinese] [绅士仓库汉化]
2022-03-27 19:52:16.116 | INFO | __main__:show_result:41 - https://e-hentai.org/g/2088139/c686827a7e/
2022-03-27 19:52:16.116 | INFO | __main__:show_result:42 - https://ehgt.org/t/bb/9f/bb9f35a23e1fe20949a7bc5eb605db9dc25e3758-9205912-2566-3600-png_250.jpg
2022-03-27 19:52:16.116 | INFO | __main__:show_result:43 - Non-H
2022-03-27 19:52:16.116 | INFO | __main__:show_result:44 - 2021-12-18 14:49 2021-12-18 14:49
2022-03-27 19:52:16.116 | INFO | __main__:show_result:45 - ['chinese', 'translated', 'f:fishnets', 'f:pantyhose', 'f:school gym uniform', 'f:schoolgirl uniform', 'f:swimsuit', 'mignon works', 'mignon', 'artbook', 'full color']
2022-03-27 19:52:16.116 | INFO | __main__:show_result:46 - --------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
上次更新: 2022/05/21, 22:01:46