Files
zhenxun_bot/plugins/nonebot_plugin_picsearcher/__pycache__/ascii2d.cpython-39.pyc
T

20 lines
2.6 KiB
Plaintext
Raw Normal View History

2021-05-20 17:06:54 +08:00
a
a¡`, ã@sªddlmZmZddlmZddlZddlmZddlm Z ddl
m Z ddl m
Z
ddlmZdd lmZddlZed
œd d „Zed
œdd„Zed
œdd„Zdd„ZdS)é)ÚListÚTuple)ÚurljoinN)Úget_local_proxy)Úget_user_agent)Ú
IMAGE_PATH)Ú TimeoutError)Úimage)Ú
fromstring)Úhtmlccs¨t|ƒ}| d¡dd…D]ˆ}| d¡}r:td|dƒ}| d¡}rP|d}| d¡}rf|d}| d ¡}r||d}| d
¡}r’|d}|||||fVqdS) NzJ//div[@class="container"]/div[@class="row"]/div/div[@class="row item-box"]ééz./div/img[@loading="lazy"]/@srczhttps://ascii2d.net/rz./div/div/h6/a[1]/text()z./div/div/h6/a[2]/text()z./div/div/h6/a[1]/@hrefz./div/div/h6/a[2]/@href)r
Úxpathr)r ÚselectorÚtagÚpic_urlÚ descriptionÚauthorZ
origin_urlZ
author_url©rú-plugins\nonebot_plugin_picsearcher\ascii2d.pyÚ
parse_htmlsr)Úurlc
Ãs¦d|}t ¡4IdHšt}| |¡4IdHš$}| ¡IdH}WdƒIdHqf1IdHs\0Ydd„t|ƒDƒWdƒIdHS1IdHs˜0YdS)Nzhttps://ascii2d.net/search/url/cSsg|]}|‘qSrr)Ú.0ÚirrrÚ
<listcomp>&óz$get_pic_from_url.<locals>.<listcomp>)ÚaiohttpÚ
ClientSessionÚgetÚtextr)rÚreal_urlÚsessionÚrespr rrrÚget_pic_from_url!s
8r#cCslt|ƒIdH}|s d}|VdS|D]B}t|d|ƒIdHd}|dd…D]}||›d�}qL|Vq$dS)Nu找ä¸�到高相似度的rÚ
r )r#Ú download_img)rÚuser_idÚ