import requests
from bs4 import BeautifulSoup

url = "https://www.shouguang.gov.cn/news/hpgs/202607/t20260710_6574526.html"
r = requests.get(url, headers={"User-Agent": "Mozilla/5.0"}, timeout=30)
r.encoding = "utf-8"
soup = BeautifulSoup(r.text, "html.parser")

content_div = soup.find("div", class_="content") or soup.find(id="mainText")
if content_div:
    print("Found content div")
    trs = content_div.find("div", class_="TRS_Editor")
    if trs:
        print("TRS_Editor found")
        children = trs.find_all(["p", "table", "img"], recursive=False)
        print("Direct children:", len(children))
        for ch in children[:3]:
            txt = ch.get_text(" ", strip=True)
            print("  <" + ch.name + ">: " + txt[:80])
    else:
        print("No TRS_Editor")
        # Try find_all p
        ps = content_div.find_all("p")
        print("All p in content_div:", len(ps))
        if ps:
            print("First p:", ps[0].get_text(" ", strip=True)[:80])
else:
    print("No content div found")
