20 lines
564 B
Python
20 lines
564 B
Python
import urllib.request, re
|
|
|
|
req = urllib.request.Request('https://github.com/SkillNerds/xskill',
|
|
headers={'User-Agent': 'Mozilla/5.0'})
|
|
resp = urllib.request.urlopen(req, timeout=15)
|
|
html = resp.read().decode('utf-8')
|
|
|
|
# Find description from meta
|
|
m = re.search(r'<meta name="description" content="([^"]+)"', html)
|
|
if m:
|
|
print(f"描述: {m.group(1)[:200]}")
|
|
else:
|
|
print("未找到meta描述")
|
|
|
|
# Find repo name from title
|
|
m = re.search(r'<title>([^<]+)</title>', html)
|
|
if m:
|
|
print(f"标题: {m.group(1)}")
|
|
|
|
print(f"页面大小: {len(html)} bytes") |