summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/tools/get_commits.py
blob: 0d4b403e47353463d615f164a305b924d332c8d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup
import re

URL = "https://sourceware.org/git/bzip2.git/log/?ofs=0"

HEADERS = {
    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
                  "(KHTML, like Gecko) Chrome/120.0 Safari/537.36",
    "Accept": "text/html",
}

r = requests.get(URL, headers=HEADERS, timeout=30)
r.raise_for_status()

soup = BeautifulSoup(r.text, "html.parser")

commits = []
seen = set()

for a in soup.select('a[href*="commit/?id="]'):
    href = a.get("href", "")
    commit = href.split("commit/?id=")[-1]
    if re.fullmatch(r"[0-9a-f]{7,40}", commit):
        if commit not in seen:
            commits.append(commit)
            seen.add(commit)

# newest → oldest geliyor
commits.reverse()

if not commits:
    raise RuntimeError("Commit bulunamadı — sourceware HTML hâlâ filtreliyor")

for c in commits:
    print(c)