From eb8cf8348cab7f1a5802bf3693239dfbb952ad33 Mon Sep 17 00:00:00 2001 From: Ubergeek Date: Sun, 24 Mar 2019 17:36:16 +0000 Subject: [PATCH] gen_tdp --- gen_tdp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ tilde.json | 1 + 2 files changed, 48 insertions(+) create mode 100755 gen_tdp create mode 100644 tilde.json diff --git a/gen_tdp b/gen_tdp new file mode 100755 index 0000000..f135c64 --- /dev/null +++ b/gen_tdp @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import subprocess,json,os.path,requests +from bs4 import BeautifulSoup as bs + +headers = { + 'Accept-Encoding': 'gzip, deflate, sdch', + 'Accept-Language': 'en-US,en;q=0.8', + 'Upgrade-Insecure-Requests': '1', + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', + 'Cache-Control': 'max-age=0', + 'Connection': 'keep-alive', +} + +tdp = {} +tdp["name"] = "tilde.team" +tdp["url"] = "https://tilde.team" +tdp["signup_url"] = tdp["url"]+"/signup" +users = subprocess.check_output(["/usr/bin/members","tilde"]).decode('ascii').split() +users.sort() +tdp["user_count"] = len(users)-1 +tdp["want_users"] = True +tdp["admin_email"] = "sudoers@tilde.team" +tdp["description"] = "a digital community for socializing, learning, and making cool stuff, tilde.team 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: + if user=="anton": + continue + tdpuser = dict(username=user) + print ("https://thunix.net/~{}".format(user)) + title = bs(requests.get("https://thunix.net/~{}".format(user)).text,"lxml").title + if title is None: + title = "No title" + else: + title = title.text + tdpuser["title"] = title + if os.path.exists(os.path.expanduser("~{}/public_html/index.html".format(user))): + tdpuser["mtime"] = os.path.getmtime(os.path.expanduser("~{}/public_html/index.html".format(user))) + elif os.path.exists(os.path.expanduser("~{}/public_html/index.htm".format(user))): + tdpuser["mtime"] = os.path.getmtime(os.path.expanduser("~{}/public_html/index.htm".format(user))) + elif os.path.exists(os.path.expanduser("~{}/public_html/index.php".format(user))): + tdpuser["mtime"] = os.path.getmtime(os.path.expanduser("~{}/public_html/index.php".format(user))) + tdpusers.append(tdpuser) +tdp["users"] = tdpusers + +with open("tilde.json","w") as f: + json.dump(tdp,f) diff --git a/tilde.json b/tilde.json new file mode 100644 index 0000000..161c271 --- /dev/null +++ b/tilde.json @@ -0,0 +1 @@ +{"want_users": true, "users": [{"username": "abah", "title": "403 Forbidden"}, {"username": "abimks", "title": "403 Forbidden"}, {"username": "adam", "title": "403 Forbidden"}, {"username": "akoeabi", "title": "403 Forbidden"}, {"username": "amcclure", "title": "Home Page - Anton McClure", "mtime": 1552508741.2007833}, {"username": "andro", "title": "403 Forbidden"}, {"username": "angelok", "title": "MySQL Fatal Error", "mtime": 1549477374.0553179}, {"username": "apple", "title": "403 Forbidden"}, {"username": "arda", "title": "403 Forbidden"}, {"username": "audiofile", "title": "403 Forbidden"}, {"username": "ben", "title": "Index of /~ben"}, {"username": "bercik", "title": "403 Forbidden"}, {"username": "brendantcc", "title": "BrendanTCC's lil page on thunix", "mtime": 1550445191.0}, {"username": "bullah", "title": "403 Forbidden"}, {"username": "campari", "title": "403 Forbidden"}, {"username": "chuck", "title": "Index of /~chuck"}, {"username": "cyphyx", "title": "hmix : ", "mtime": 1553072300.510817}, {"username": "dalist", "title": "403 Forbidden"}, {"username": "derby", "title": "403 Forbidden"}, {"username": "diabla", "title": "Your Title Here", "mtime": 1547162566.1007679}, {"username": "dragon", "title": "Index of /~dragon"}, {"username": "fosslinux", "title": "Index of /~fosslinux"}, {"username": "freuddy", "title": "Index of /~freuddy"}, {"username": "gokce", "title": "No title", "mtime": 1546898454.1457999}, {"username": "gooly", "title": "Index of /~gooly"}, {"username": "hasbullah", "title": "403 Forbidden"}, {"username": "hawaii", "title": "403 Forbidden"}, {"username": "hexhaxtron", "title": "Index of /~hexhaxtron"}, {"username": "janda", "title": "403 Forbidden"}, {"username": "johnc", "title": "403 Forbidden"}, {"username": "jumbajookiba", "title": "403 Forbidden"}, {"username": "jundi", "title": "403 Forbidden"}, {"username": "k4j", "title": "403 Forbidden"}, {"username": "khuxkm", "title": "403 Forbidden"}, {"username": "krystianbajno", "title": "403 Forbidden"}, {"username": "larasaty", "title": "403 Forbidden"}, {"username": "letamesis", "title": "403 Forbidden"}, {"username": "logique", "title": "403 Forbidden"}, {"username": "makassar", "title": "403 Forbidden"}, {"username": "makmur", "title": "403 Forbidden"}, {"username": "mks", "title": "403 Forbidden"}, {"username": "ml", "title": "ml at thunix dot cf", "mtime": 1548237923.6255133}, {"username": "mom", "title": "403 Forbidden"}, {"username": "naglfar", "title": "No title", "mtime": 1553104056.16482}, {"username": "naruto", "title": "403 Forbidden"}, {"username": "orliesaurus", "title": "No title", "mtime": 1546826452.5047188}, {"username": "os", "title": "Welcome to the Tilde Operating System Project! - TildeOS Project", "mtime": 1551395893.4820418}, {"username": "panzer", "title": "Index of /~panzer"}, {"username": "parik", "title": "No title", "mtime": 1545595770.8315115}, {"username": "pria", "title": "403 Forbidden"}, {"username": "quetzalcoatl", "title": "No title", "mtime": 1548114833.6806962}, {"username": "r", "title": "403 Forbidden"}, {"username": "rado", "title": "403 Forbidden"}, {"username": "ragnarok", "title": "403 Forbidden"}, {"username": "redhat", "title": "Index of /~redhat"}, {"username": "responsibleracoon", "title": "403 Forbidden"}, {"username": "ringo", "title": "No title", "mtime": 1546477863.427092}, {"username": "riska", "title": "403 Forbidden"}, {"username": "sata", "title": "403 Forbidden"}, {"username": "slip", "title": "Index of /~slip"}, {"username": "smtpsupplicant", "title": "Index of /~smtpsupplicant"}, {"username": "spanmer", "title": "Index of /~spanmer"}, {"username": "swann", "title": "403 Forbidden"}, {"username": "techemporium", "title": "TechEmporium's Test Rig", "mtime": 1548830552.0}, {"username": "transfusion", "title": "Index of /~transfusion"}, {"username": "trip", "title": "Index of /~trip"}, {"username": "ubergeek", "title": "Ubergeek", "mtime": 1552954373.3815272}, {"username": "ukhuwah", "title": "403 Forbidden"}, {"username": "ultima", "title": "403 Forbidden"}, {"username": "user", "title": "403 Forbidden"}, {"username": "usernameak", "title": "No title", "mtime": 1547590669.223605}, {"username": "usher", "title": "403 Forbidden"}, {"username": "vgk", "title": "403 Forbidden"}, {"username": "vigilant", "title": "Index of /~vigilant"}, {"username": "wesx", "title": "403 Forbidden"}, {"username": "xenialito69", "title": "Index of /~xenialito69"}, {"username": "z00t", "title": "403 Forbidden"}], "url": "https://tilde.team", "admin_email": "sudoers@tilde.team", "name": "tilde.team", "user_count": 77, "description": "a digital community for socializing, learning, and making cool stuff, tilde.team is a shared system that provides a radically inclusive, non-commercial space for teaching, learning, practicing and enjoying the social medium of unix.", "signup_url": "https://tilde.team/signup"} \ No newline at end of file