Files
twoJob-demo/scripts/__pycache__/capture_full.cpython-313.pyc
T

122 lines
12 KiB
Plaintext
Raw Normal View History

2026-09-03 15:35:23 +08:00
ó
ÃZj
#ãóž•SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSr \RR\RR055r
SrSrSrSrSrS rS
rS rS rSSjr\S:XaV\R2Sr\R2Sr\"\R25S:”a\"\R2S5OS
r\"\\\5 gg)u
整页滚动截图 (scroll & stitch) —— 针对 2�人事部 window 整页滚动 + fixed 顶�
用法:
python3 capture_full.py <session> <out_path> [max_tiles]
原�:
1. ��帮助/�馈/AI助手/购买浮层等固定挂件, ���挡
2. 读�滚动指标, 探测顶部 fixed 顶�高度
3. ��滚动截图(视�图), 除首�外�掉与固定顶���的部分
4. 纵�拼接为整页长图
�赖: PIL(Pillow), 通过 daemon(127.0.0.1:10086) 调用 evaluate / screenshot
éNzhttp://127.0.0.1:10086/commandcó\•[R"XUS.5R5n[RR [ USS0S9n[RUSS9n[R"UR5R55sSSS5 $!,(df  g=f)N)ÚactionÚargsÚsessionz Content-Typezapplication/json)ÚdataÚheadersé()Útimeout) ÚjsonÚdumpsÚencodeÚurllibÚrequestÚRequestÚDAEMONÚ_OPENERÚopenÚloadsÚreadÚdecode)rrrÚbodyÚreqÚresps Ú?/Users/lucky/Documents/WorkSapce/TwoJob/scripts/capture_full.pyÚcallrsx€Ü �:Š: À'ÑJÓ K× RÑ RÓ T€DÜ
�.‰.×
Ñ
¤¨d¸^ÐM_Ð<`Ð
Ð
a€CÜ �‰�c 2ˆÑ &¨$Ü�zŠz˜$Ÿ)™)›+×,Ñ,Ó.Ó/÷
'× &× &ús Á!2BÂ
B+cób•[SSU0U5nURS05RS5$)NÚevaluateÚcoderÚvalue)rÚget)rrÚrs rÚevr"s0€Ü ˆZ˜& $˜¨Ó1€AØ �5‰5�˜Ó × Ñ  Ó )Ð)ócóX•[SSSS.U5nURS05RS5nU(d%[S[R"U5SS-5eSS KJn UR[R"[R"U555RS
5$) NÚ
screenshotÚjpegéF)ÚformatÚqualityrzno screenshot data: éÈr©ÚImageÚRGB)
rr Ú RuntimeErrorr r ÚPILr,rÚioÚBytesIOÚbase64Ú b64decodeÚconvert)rr!Úb64r,s rÚshotr6s„€Ü ˆ\ f¸Ñ<¸gÓF€AØ
�%‰%�˜Ó
×
Ñ
 Ó
'€CÞ ÜÐ1´D·J²J¸q³MÀ$À3Ð4GÑGÓHÐHÝØ �:‰:”b—j’j¤×!1Ò!1°#Ó!6Ó7Ó 8× @Ñ @ÀÓ GÐGr#u
(()=>{
const sels = ['[class*="helpBox"]','[class*="aiAssistant"]','[class*="product_"]',
'[class*="feedback"]','[class*="Feedback"]','[class*="floatBar"]',
'[class*="sideBar"]','[class*="robot"]','[class*="advert"]'];
let n=0;
sels.forEach(s=>document.querySelectorAll(s).forEach(el=>{
const r=el.getBoundingClientRect();
if(r.width<600 && getComputedStyle(el).position==='fixed'){el.style.setProperty('display','none','important');n++;}
}));
// �馈竖�
document.querySelectorAll('div,a,button').forEach(el=>{
if(el.children.length<=3 && /^�\s*馈$/.test((el.innerText||'').replace(/\s/g,'')) && getComputedStyle(el).position==='fixed'){el.style.setProperty('display','none','important');n++;}
});
return n;
})()
a'
(()=>{
let hdr=0;
const walk=(el,d)=>{ if(d>5)return; for(const c of el.children){ const s=getComputedStyle(c); const r=c.getBoundingClientRect();
if((s.position==='fixed'||s.position==='sticky') && r.top<=1 && r.height>10 && r.height<200 && r.width>window.innerWidth*0.6){ if(r.height>hdr)hdr=r.height; }
walk(c,d+1);} };
walk(document.body,0);
return JSON.stringify({winH:window.innerHeight, winW:window.innerWidth,
docH:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight), hdr:Math.round(hdr)});
})()
cóf•[SUS3U5 [R"S5 [SU5$)Nz(()=>{window.scrollTo(0,z);return window.scrollY;})()çffffffÖ?z(()=>window.scrollY)())r"ÚtimeÚsleep©Úyrs rÚ scroll_tor=Es1€ÜÐ " 1 #Ð%BÐCÀWÔM܇J‚JˆtÔÜ
Ð&¨Ó 0Ð0r#a
(()=>{
const W=innerWidth,H=innerHeight; let best=null,score=0;
document.querySelectorAll('div,main,section,ul').forEach(el=>{
const s=getComputedStyle(el); const oy=s.overflowY;
if(oy!=='auto'&&oy!=='scroll') return;
const extra=el.scrollHeight-el.clientHeight; if(extra<40) return;
const r=el.getBoundingClientRect();
if(r.width<W*0.4||r.height<H*0.25) return;
if(r.bottom<H*0.4||r.top>H*0.85) return;
const sc=r.width*r.height+extra*300;
if(sc>score){score=sc;best=el;}
});
if(!best) return JSON.stringify({found:false});
document.querySelectorAll('[data-capscroll]').forEach(e=>e.removeAttribute('data-capscroll'));
best.setAttribute('data-capscroll','1');
const r=best.getBoundingClientRect();
let hs=0;
best.querySelectorAll(':scope>*,:scope>*>*,:scope>*>*>*').forEach(c=>{
const cs=getComputedStyle(c); const cr=c.getBoundingClientRect();
if((cs.position==='sticky'||cs.position==='fixed')&&cr.top<=r.top+3&&cr.height>10&&cr.height<160&&cr.width>r.width*0.5){ if(cr.height>hs)hs=cr.height; }
});
return JSON.stringify({found:true,left:Math.round(r.left),top:Math.round(r.top),
width:Math.round(r.width),height:Math.round(r.height),
scrollHeight:best.scrollHeight,clientHeight:best.clientHeight,hdr:Math.round(hs)});
})()
có2•[S[U5-U5$)Nzz(()=>{const e=document.querySelector('[data-capscroll]');if(!e)return 0;e.scrollTop=%d;return Math.round(e.scrollTop);})())r"Úintr;s rÚ scroll_innerr@gs9€Ü
ðKôNQðRSóNTñTðV]ó ^ð^r#c ón^^•SSKJn USUSpeUSUSp‡URSS5=(d Sn [SUSUS -
5n
[ [ XR-55[ [ Xb-55[ [ XW-U-55[ [ Xh-U-554mUU4S
jn [
ST5 [R"S 5 U "5n U /n
UnX‰-
nSnUU:aÝUS -
n[ [
UT5=(d S5n[R"S
5 U "5nUU-
nUS:aSn[ [ UU-55nUUR:¼a[ [ X’-55nU
RURSUURUR455 UU-nUU
S -
:¼aO Xé-
nUU:aMÝ[SU
55nURSU RU4S5nSnU
H&nURUSU45 UUR-
nM( [
ST5 UUS -4$)ua对内部滚动容器é€�å±�滚动 -> è£�剪容器区域 -> 纵å�‘拼接(å�«ç²˜æ€§è¡¨å¤´åŽ»é‡�)。rr+ÚleftÚtopÚwidthÚheightÚhdrÚ scrollHeightÚ clientHeightcó8>•[T5RT5$©N)r6Úcrop)Úboxrs€€rÚtileÚ_inner_stitch.<locals>.tileusø€Ü�G‹}×!Ñ! #Ó&Ð&r#r8ég333333Ó?c3ó8# •UHoRv• M g7frJ©rE©Ú.0Úps rÚ <genexpr>Ú _inner_stitch.<locals>.<genexpr>�sé€Ð*¢E˜q—(–(¢Eùó‚r-©éÿrYrY)r/r,r Úmaxr?Úroundr@r9r:rEÚappendrKrDÚsumÚnewÚpaste)rÚscÚscaleÚ max_tilesr,rBrCrDrEÚhsÚ maxScrollrMÚfirstÚpartsÚ prev_bottomÚtargetÚguardÚactualYÚimgÚ crop_logicalÚcrop_pxÚtotal_hÚstitchedr<rTrLs` @rÚ
_inner_stitchrpksù€åØ�6‘
˜B˜u™Iˆ#Ø�w‘K  H¡ˆ6Ø �‰��qÓ × ˜Q€BÜ�A�r˜.Ñ)¨B¨~Ñ,>Ñ>Ó?€IÜ Œu�T‘\Ó"Ó #¤S¬¨s©{Ó);Ó%<Ü Œu�d‘l eÑ+Ó,Ó -¬s´5¸#¹,È%Ñ9OÓ3PÓ/Qð S€Cö'ô��GÔœdŸjšj¨Ô.Ù ‹F€EØ
ˆG€EØ€KØ
‰[€FØ
€EØ
�)Ó
Ø
�‰
ˆÜ”l 6¨7Ó3×8°qÓ9ˆ¼4¿:º:Àc¼?Ù‹fˆØ" WÑ,ˆ Ø ˜!Ó ØˆLÜ”e˜L¨5Ñ0Ó1Ó2ˆØ �c—j‘jÓ Üœ% ¡
Ó+Ó,ˆGØ
� ‰ �S—X‘X˜q '¨3¯9©9°c·j±jÐAÓBÔCØ Ñ&ˆ Ø �i !‘mÓ #Ø ØÑ!ˆð �)Õ
ôÑ*¡EÓ*Ó*€GØ�y‰y˜ §¡¨gÐ 6¸ÓH€HØ €AÛ
ˆØ�‰�q˜1˜a˜&Ô! 1¨¯©¡=¢1ñä��GÔØ �U˜Q‘YÐ Ðr#éc ó•SSKJn [[U5 [R
"[[ U55nUSUSUSpvnUS=(d Sn[SXu-
5n [SU5 [U5n
U
RU- n [[X‹-55n U