- 공공기관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>
23 lines
990 B
Python
23 lines
990 B
Python
import requests,re,io
|
|
from bs4 import BeautifulSoup
|
|
import urllib3; urllib3.disable_warnings()
|
|
H={'User-Agent':'Mozilla/5.0'}
|
|
# 공지사항 board r50, known to have posts
|
|
for u in ["https://www.kdhc.co.kr/kdhc/bbs/B0000020/list.do?menuNo=200124",
|
|
"https://www.kdhc.co.kr/kdhc/bbs/B0000117/list.do?menuNo=200560"]:
|
|
r=requests.get(u,headers=H,timeout=25,verify=False)
|
|
s=BeautifulSoup(r.content,'html.parser')
|
|
print('URL',u)
|
|
# find elements containing '건' or 'total' or page count
|
|
for el in s.find_all(string=re.compile(r'건|페이지|Total|총')):
|
|
t=el.strip()
|
|
if t and len(t)<80: print(' txt:',repr(t))
|
|
# count list rows
|
|
for sel in ['table tbody tr','ul.board_list li','.board-list li','tbody tr']:
|
|
rows=s.select(sel)
|
|
if rows: print(' rows[%s]=%d'%(sel,len(rows)))
|
|
# page links / last page
|
|
pag=s.select('a[href*="pageIndex"], .paging a, .pagination a')
|
|
print(' paglinks=',len(pag))
|
|
print('---')
|