Files
SnarfCode/scripts/check_sn_nas_html.py

22 lines
654 B
Python

import urllib.request
import ssl
import re
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = "https://sn-nas.snarfnet.net/"
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
resp = urllib.request.urlopen(req, context=ctx)
print("Status:", resp.status)
html = resp.read().decode('utf-8', errors='replace')
print("HTML length:", len(html))
# Find script tags and link tags
tags = re.findall(r'<(?:script|link)[^>]+(?:src|href)="([^"]+)"', html)
print(f"Found {len(tags)} resources in HTML:")
for t in tags[:15]:
print(" ", t)