DB_JOB/작업파일/완료/광역_사이트맵/충청북도/_probe_cj2.py
hehihoho3 df16c98366 백업: DB수집 전체 스냅샷 (공공기관2 정리 전)
공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외.

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

17 lines
685 B
Python

# -*- coding: utf-8 -*-
import sys,io,urllib.request,ssl,re
from bs4 import BeautifulSoup
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
def get(u):
req=urllib.request.Request(u,headers={'User-Agent':'Mozilla/5.0'})
return urllib.request.urlopen(req,timeout=25,context=ctx).read().decode('utf-8','ignore')
h=get('https://www.chungju.go.kr/www/sitemap.do?key=553')
s=BeautifulSoup(h,'html.parser')
boxes=s.select('div.sitemap_box')
print('sitemap_box',len(boxes))
if boxes:
b=boxes[0]
print('첫박스 구조 일부:')
print(re.sub(r'\s+',' ',str(b))[:1400])