1 #!/usr/bin/env nix-shell
2 #!nix-shell --pure --keep NIX_PATH -i python3 -p git nix-update "python3.withPackages (ps: [ ps.beautifulsoup4 ps.requests ])"
8 from bs4
import BeautifulSoup
10 VERSION_PATTERN
= re
.compile(r
'^steam_(?P<ver>(\d+\.)+)tar.gz$')
13 response
= requests
.get("https://repo.steampowered.com/steam/archive/stable/")
14 soup
= BeautifulSoup (response
.text
, "html.parser")
15 for a
in soup
.find_all("a"):
17 if not href
.endswith(".tar.gz"):
20 match
= VERSION_PATTERN
.match(href
)
22 version
= match
.groupdict()["ver"][0:-1]
23 found_versions
.append(version
)
25 if len(found_versions
) == 0:
26 print("Failed to find available versions!", file=sys
.stderr
)
30 subprocess
.run(["nix-update", "--version", found_versions
[-1], "steam-unwrapped"])