import requests,json,io,re,time
from bs4 import BeautifulSoup
from urllib.parse import urljoin
import urllib3; urllib3.disable_warnings()
H={'User-Agent':'Mozilla/5.0'}
BASE="https://www.kdhc.co.kr"
def fetch(u):
    r=requests.get(u,headers=H,timeout=25,verify=False); return r
# G7 raw hrefs (사전정보공표) - fetch r11 page
r=fetch("https://www.kdhc.co.kr/kdhc/infoOthbc/infoPrmlgt/list.do?menuNo=200013")
s=BeautifulSoup(r.content,'html.parser')
print("=== G7 사전정보공표 tebLi raw ===")
for ul in s.find_all('ul'):
    lis=ul.find_all('li',class_='tebLi')
    if not lis: continue
    for li in lis:
        a=li.find('a')
        if a: print('  ',repr(a.get_text(strip=True)),'->',a.get('href'))
    break
# check '전체' / total count on board
tot=s.find(string=re.compile(r'(전체|총)\s*[:：]?\s*\d'))
print('total hint:',repr(tot.strip()[:60]) if tot else None)

# G9 안전경영 raw hrefs (None menuNo case)
print("=== G9 안전경영 tebLi raw ===")
r=fetch("https://www.kdhc.co.kr/kdhc/main/contents.do?menuNo=200088")
s=BeautifulSoup(r.content,'html.parser')
for ul in s.find_all('ul'):
    lis=ul.find_all('li',class_='tebLi')
    if not lis: continue
    for li in lis:
        a=li.find('a')
        if a: print('  ',repr(a.get_text(strip=True)),'->',a.get('href'))
    break
