Initial commit
This commit is contained in:
commit
f45881dc88
161 files changed
+21597
No files matched your search
@@ -0,0 +1,20 @@
|
||||
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")
|
||||
Reference in new issue
Block a user