DB_JOB/작업파일/공공기관2/14.한국청소년정책연구원/_chk_lb.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

29 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import sys,io
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
from playwright.sync_api import sync_playwright
C={
'r43_고객헌장':"https://www.nypi.re.kr/board?menuKey=Thgr6HhSqf&bbsId=BOARD00030",
'r48_사전정보공개':"https://www.nypi.re.kr/board?menuKey=&bbsId=BOARD00041",
'r52_공공데이터개방':"https://www.nypi.re.kr/board?menuKey=PxtUOCbTJ1&bbsId=BOARD00038",
}
with sync_playwright() as p:
br=p.chromium.launch(headless=True); ctx=br.new_context(ignore_https_errors=True,viewport={'width':1280,'height':1600})
for nm,u in C.items():
pg=ctx.new_page()
try:
pg.goto(u,wait_until='networkidle',timeout=30000); pg.wait_for_timeout(1200)
r=pg.evaluate(r"""()=>{
const body=document.body.innerText;
const hasTotal=/총\s*\d|전체\s*\d|건수|페이지/.test(body);
const rows=document.querySelectorAll('table tbody tr, .board_list li, ul.list li').length;
const pager=document.querySelectorAll('.paging a, .pagination a, [class*=paging] a').length;
const search=document.querySelectorAll('input[type=search], .search_area, [class*=search] input').length;
return {hasTotal, rows, pager, search, title:document.title.slice(0,35)};
}""")
print(nm,'::',r)
except Exception as e:
print(nm,'ERR',str(e)[:40])
pg.close()
br.close()