# -*- 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
