DB_JOB/작업파일/공공기관2/10.한국지역난방공사/_norows.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

26 lines
1.4 KiB
Python

import requests,re
from bs4 import BeautifulSoup
import urllib3; urllib3.disable_warnings()
H={'User-Agent':'Mozilla/5.0'}
urls={
'사회공헌위원회':"https://www.kdhc.co.kr/kdhc/bbs/B0000008/list.do?menuNo=200106",
'시민열냉방시설기준':"https://www.kdhc.co.kr/kdhc/cstmrCnter/arclngFclty/list.do?fcltyParntsSe=02&menuNo=200276",
'안전경영방침(B30)':"https://www.kdhc.co.kr/kdhc/bbs/B0000030/list.do?menuNo=200091",
'한난사보20-23':"https://www.kdhc.co.kr/kdhc/prCnter/cyclb/list.do?prTargetSe=2&menuNo=200127",
'한난사보-19':"https://www.kdhc.co.kr/kdhc/prCnter/cyclb/list.do?prTargetSe=3&menuNo=200427",
'FAQ':"https://www.kdhc.co.kr/kdhc/bbs/B0000010/list.do?menuNo=200271",
}
for nm,u in urls.items():
r=requests.get(u,headers=H,timeout=25,verify=False)
s=BeautifulSoup(r.content,'html.parser')
pi=s.find(string=re.compile(r'\d+\s*/\s*\d+\s*페이지'))
pg=re.search(r'(\d+)\s*/\s*(\d+)',pi).groups() if pi else None
views=set(re.findall(r'view\.do\?[^"\' ]*nttId=(\d+)',r.text))
cyclb=set(re.findall(r'(?:view|detail)\.do\?[^"\' ]*?(?:cyclbId|nttId|seq)=(\d+)',r.text))
li_imgs=len(s.select('#contents img, #contents li, .contents li'))
print(f'== {nm} pages={pg} viewlinks={len(views)} liimg={li_imgs}')
# show some list item count candidates
for sel in ['table tbody tr','.gallery li','ul.list li','.list li','dl dt']:
x=s.select(sel)
if x: print(' ',sel,len(x))