Files
SnarfCode/scripts/check_homepage_html.py

17 lines
529 B
Python

import urllib.request, ssl, re
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
req = urllib.request.Request('https://homepage.snarfnet.net/', headers={'User-Agent': 'Mozilla/5.0'})
resp = urllib.request.urlopen(req, context=ctx)
html = resp.read().decode('utf-8')
for pat in [r'href="([^"]+)"', r'src="([^"]+)"']:
matches = re.findall(pat, html)
for m in matches:
if any(k in m for k in ['argo', 'tempest', 'weather', 'icon', 'png', 'svg']):
print(m)