DB_JOB/작업파일/공공기관2/6.한국중부발전/_temp_chk.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

20 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
import ssl,urllib.request
from bs4 import BeautifulSoup
ctx=ssl.create_default_context();ctx.check_hostname=False;ctx.verify_mode=ssl.CERT_NONE
HDR={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/124 Safari/537.36'}
def fetch(u): return urllib.request.urlopen(urllib.request.Request(u,headers=HDR),timeout=25,context=ctx).read()
tests={'r105_해외사업_img_tab':'https://www.komipo.co.kr/kor/content/44/main.do?mnCd=FN020901',
'r109_부서전화_tabB':'https://www.komipo.co.kr/kor/content/169/main.do?mnCd=FN0212',
'r202_연도별_depthbox':'https://www.komipo.co.kr/esg/content/405/main.do?mnCd=ESG04010202'}
for n,u in tests.items():
soup=BeautifulSoup(fetch(u),'html.parser')
for ul in soup.find_all('ul'):
cls=' '.join(ul.get('class') or [])
if 'tab' not in cls or 'tab_link' in cls: continue
lis=ul.find_all('li',recursive=False)
a0=lis[0].find('a') if lis else None
if not a0: continue
print(n,'| ul.%s | first a attrs:'%cls, dict(a0.attrs))
break