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

45 lines
4.0 KiB
Plaintext
Raw Normal View History

2021-05-20 17:06:54 +08:00
a
+3“`Vã@s,UddlmZddlmZmZddlZddlmZddlZddl Z ddl
m Z ddl m
Z
ddlmZe  ¡ZejjZeed <ejjZeed
<d Zeed <d
dddddddddddddddœZerÌeed<n$ded<d ed!<d"ed#<d$Zeed <ed%œd&d'„Zed(œd)d*„Zed(œd+d,„Zed(œd-d.„ZdS)/é)Ú b64encode)ÚListÚTupleN)Ú
fromstring)Ú
InvalidURL)ÚMessageSegmenté)ÚFormDataÚcookieÚproxyz,https://exhentai.org/upload/image_lookup.phpÚtargetz|text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9z
gzip, deflatezzh-CN,zh;q=0.9z max-age=0z
keep-alivezDmultipart/form-data; boundary=----WebKitFormBoundaryB0NrMSYMfjY5r0l1z exhentai.orgzhttps://exhentai.orgz"https://exhentai.org/?filesearch=1ÚdocumentÚnavigatez same-originz?1Ú1zsMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36)ÚAcceptzAccept-EncodingzAccept-Languagez
Cache-ControlÚ
Connectionz Content-TypeÚHostÚOriginÚRefererzSec-Fetch-DestzSec-Fetch-ModezSec-Fetch-SitezSec-Fetch-UserzUpgrade-Insecure-Requestsz
User-AgentÚCookiez e-hentai.orgrzhttps://e-hentai.orgrz"https://e-hentai.org/?filesearch=1rz,https://e-hentai.org/upload/image_lookup.php)ÚhtmlccsNt|ƒ}| d¡}| d¡}| d¡}t|||ƒD]\}}}|||fVq2dS)uE
解�exhentai返回的数�
:param html:
:return:
z"//td[@class="gl3c glname"]/a/@hrefz*//td[@class="gl3c glname"]/a/div[1]/text()z<//tr/td[@class="gl2c"]/div[@class="glthumb"]/div[1]/img/@srcN)rÚxpathÚzip)rÚselectorÚhrefsÚnamesZpicsÚnameÚhrefÚpic©rú(plugins\nonebot_plugin_picsearcher\ex.pyÚ
parse_html-s 


r!)Úurlc
Ãs4t ¡4IdH�š}| |¡4IdHš*}t | ¡IdH¡}WdƒIdHqf1IdHs\0Ytdd�}|jd|ddd�|jdd d
�|jd d d
�|jt |t
t d
�4IdHš$}|  ¡IdH}WdƒIdHqò1IdHsè0Ydd„t
|ƒDƒWdƒIdHS1IdH�s&0YdS)uN
从接�到的picurl获�图片信�
:param url:
:return:
Nz&----WebKitFormBoundaryB0NrMSYMfjY5r0l1)ÚboundaryÚsfilez
image/jpegz0.jpg)rÚvalueÚ content_typeÚfilenameZf_sfileÚsearch)rr%Z
fs_similarÚon)ÚdataÚheadersr cSsg|]}|‘qSrr)Ú.0Úirrr Ú
<listcomp>Lóz$get_pic_from_url.<locals>.<listcomp>)ÚaiohttpÚ
ClientSessionÚgetÚioÚBytesIOÚreadr Ú add_fieldÚpostr r+r Útextr!)r"ÚsessionÚrespÚcontentr*Úresrrrr Úget_pic_from_url;s>

ÿ8r=c
ÃsÒz²t ¡4IdHšˆ}|j|td�4IdHšF}dt| ¡IdHƒ ¡WdƒIdHWdƒIdHWS1IdHs|0YWdƒIdHq°1IdHs¦0YWntjjyÌ|YS0dS)u>
从url 获得b64 encode
:param url:
:return:
N)r+z base64://) r0r1r2r+rr5ÚdecodeÚclient_exceptionsr)r"r9r:rrr Úget_content_from_urlOs ˆr@cCslt|ƒIdH}|s d}|VdS|D]B\}}}t|ƒIdH}tj|d�d|›d�d|›d�}|Vq$dS)u?
迭代���的信�
:param url: