DB_JOB/작업파일/완료/광역_사이트맵/전북특별자치도/3.김제시/_probe.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

18 lines
804 B
Python

# -*- coding: utf-8 -*-
import sys, urllib.request, ssl, re
sys.stdout.reconfigure(encoding='utf-8')
from bs4 import BeautifulSoup
ctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
url='https://www.gimje.go.kr/index.gimje?menuCd=DOM_000000101004002001'
req=urllib.request.Request(url, headers={'User-Agent':'Mozilla/5.0'})
html=urllib.request.urlopen(req, context=ctx, timeout=30).read().decode('utf-8','replace')
soup=BeautifulSoup(html,'html.parser')
# find any div whose class contains basic_tab
for div in soup.find_all('div'):
cls=' '.join(div.get('class') or [])
if 'basic_tab' in cls:
print('=== DIV class=', cls, '===')
for a in div.find_all('a'):
print(' a href=', a.get('href'), '| text=', a.get_text(strip=True))