DB_JOB/작업파일/공공기관2/6.한국중부발전/_temp_render.py
hehihoho3 b0acd1e705 백업: 셀병합 정상화(D~J)+KDHC 옵션2/행높이17, 오늘(06-21) 제출 17곳 검수·압축
- 공공기관2/3 작업본 + 오늘 제출 17곳 D~J 카테고리 셀병합 정상화
- 한국지역난방공사 옵션2(고아셀 F98 수정)+전행 높이17
- 제출_프리랜서2_2026-06-21.zip 생성(17개 xlsx, 2,468행)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 13:21:26 +09:00

36 lines
1.8 KiB
Python

# -*- coding: utf-8 -*-
from playwright.sync_api import sync_playwright
targets={
'r166_기후변화':'https://www.komipo.co.kr/esg/content/102/main.do?mnCd=ESG020201',
'r179_인권위원회':'https://www.komipo.co.kr/esg/content/393/main.do?mnCd=ESG030301',
'r222_홍보영상':'https://www.komipo.co.kr/kor/content/126/main.do?mnCd=FN0902',
'r223_KOMIPOMEDIA':'https://www.komipo.co.kr/kor/content/215/main.do?mnCd=FN090202',
'r40_정보보호':'https://www.komipo.co.kr/kor/content/446/main.do?mnCd=FN0107',
'r16_489':'https://www.komipo.co.kr/kor/content/489/main.do',
'r84_24':'https://www.komipo.co.kr/kor/content/24/main.do',
'r221_135':'https://www.komipo.co.kr/kor/content/135/main.do',
}
import os
os.makedirs('_render',exist_ok=True)
with sync_playwright() as p:
b=p.chromium.launch()
pg=b.new_page(viewport={'width':1280,'height':1400},ignore_https_errors=True)
for n,u in targets.items():
try:
pg.goto(u,timeout=30000,wait_until='networkidle')
pg.wait_for_timeout(1500)
el=pg.query_selector('#content') or pg.query_selector('div.contents')
info={}
if el:
el.screenshot(path=f'_render/{n}.png')
# detect media
vids=pg.eval_on_selector_all('#content video, #content iframe',
'els=>els.map(e=>({t:e.tagName,src:e.src||e.currentSrc||""}))')
imgs=pg.eval_on_selector_all('#content img',
'els=>els.filter(i=>i.naturalWidth>=200&&i.naturalHeight>=150).map(i=>({w:i.naturalWidth,h:i.naturalHeight,alt:i.alt,src:i.src.split("/").pop()}))')
print(n,'| media:',vids,'| bigimgs:',len(imgs))
for im in imgs[:6]: print(' ',im['w'],'x',im['h'],im['alt'][:40],im['src'][:30])
except Exception as e:
print(n,'ERR',str(e)[:60])
b.close()