16 lines
922 B
Python
16 lines
922 B
Python
import requests, re
|
|
|
|
H = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
|
|
for url in ["https://bitbucket.org/repo/all/", "https://bitbucket.org/repo/all/?sort=-updated"]:
|
|
r = requests.get(url, headers=H, timeout=25)
|
|
print(url, "->", r.status_code, len(r.text))
|
|
if r.status_code == 200:
|
|
# repo links look like /workspace/slug
|
|
links = re.findall(r'href="/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)"', r.text)
|
|
# filter nav junk
|
|
bad = {"site", "account", "signin", "signup", "plans", "product", "support",
|
|
"pricing", "account-settings", "download", "features", "legal",
|
|
"whats-new", "resources", "support-plan", "status", "security"}
|
|
good = [(a, b) for a, b in links if a.lower() not in bad and len(a) > 2 and
|
|
not a.startswith(("repo", "workspaces"))][:15]
|
|
print(" sample repo links:", good[:10]) |