You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

#!/usr/bin/env python3
import subprocess, json, os.path, requests
from bs4 import BeautifulSoup as bs
tdp = {}
tdp["name"] = ""
tdp["url"] = ""
tdp["signup_url"] = tdp["url"] + "/signup/"
users = subprocess.check_output(["/usr/bin/members", "team"]).decode("ascii").split()
tdp["user_count"] = len(users)
tdp["want_users"] = True
tdp["admin_email"] = ""
tdp["description"] = "a digital community for socializing, learning, and making cool stuff, is a shared system that provides a radically inclusive, non-commercial space for teaching, learning, practicing and enjoying the social medium of unix."
tdpusers = []
for user in users:
tdpuser = dict(username=user)
title = bs(
requests.get(f"{user}/", allow_redirects=False).text,
title = "No title"
tdpuser["title"] = title
if os.path.exists(f"/home/{user}/public_html/index.html"):
tdpuser["mtime"] = os.path.getmtime(f"/home/{user}/public_html/index.html")
elif os.path.exists(f"/home/{user}/public_html/index.cgi"):
tdpuser["mtime"] = os.path.getmtime(f"/home/{user}/public_html/index.cgi")
elif os.path.exists(f"/home/{user}/public_html/index.php"):
tdpuser["mtime"] = os.path.getmtime(f"/home/{user}/public_html/index.php")
tdp["users"] = tdpusers
with open("tilde.json", "w") as f:
json.dump(tdp, f)