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

28 lines
1.0 KiB
Python

# coding: utf-8
import sys, re, urllib.request, ssl
from bs4 import BeautifulSoup
ctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
UA={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}
def get(url):
req=urllib.request.Request(url, headers=UA)
raw=urllib.request.urlopen(req, timeout=30, context=ctx).read()
return BeautifulSoup(raw, 'html.parser')
url=sys.argv[1]
sp=get(url)
# find likely content container
for sel in ['#contents','#content','.contents','.content','#sub_content','.sub_content','#container','.cont_area','.board_view','.bbs_view']:
n=sp.select_one(sel)
if n:
imgs=n.find_all('img')
print(f"== {sel}: imgs={len(imgs)}")
for i in imgs[:30]:
print(" IMG", (i.get('src') or '')[:90], '| alt=', (i.get('alt') or '')[:40])
ifr=n.find_all('iframe')
for f in ifr[:10]:
print(" IFRAME", (f.get('src') or '')[:90])
break
print("---ALL IMG count in page:", len(sp.find_all('img')))