def fetch_observer(args: argparse.Namespace) -> int:
logger.debug("args[]='%s' - CALLED!", type(args))
- types = [
- "akkoma",
- "birdsitelive",
- "bookwyrm",
- "calckey",
- "diaspora",
- "foundkey",
- "friendica",
- "funkwhale",
- "gancio",
- "gnusocial",
- "gotosocial",
- "hometown",
- "hubzilla",
- "kbin",
- "ktistec",
- "lemmy",
- "mastodon",
- "microblogpub",
- "misskey",
- "mitra",
- "mobilizon",
- "owncast",
- "peertube",
- "pixelfed",
- "pleroma",
- "plume",
- "snac",
- "takahe",
- "wildebeest",
- "writefreely"
- ]
+ # Acquire lock
locking.acquire()
+ logger.info("Fetching software list ...")
+ raw = utils.fetch_url(
+ "https://fediverse.observer",
+ network.web_headers,
+ (config.get("connection_timeout"), config.get("read_timeout"))
+ ).text
+ logger.debug("raw[%s]()=%d", type(raw), len(raw))
+
+ doc = bs4.BeautifulSoup(raw, features="html.parser")
+ logger.debug("doc[]='%s'", type(doc))
+
+ items = doc.find("div", {"aria-labelledby": "navbarDropdownMenuSoftwares"}).findAll("a", {"class": "dropdown-item"})
+ logger.debug("items[]='%s'", type(items))
+
+ types = list()
+
+ logger.info("Checking %d menu items ...", len(items))
+ for item in items:
+ logger.debug("item[%s]='%s'", type(item), item)
+ if item.text.lower() == "all":
+ logger.debug("Skipping 'All' menu entry ...")
+ continue
+
+ logger.debug("Appending item.text='%s' ...", item.text)
+ types.append(tidyup.domain(item.text))
+
logger.info("Fetching %d different table data ...", len(types))
for software in types:
logger.debug("software='%s' - BEFORE!", software)
).text
logger.debug("raw[%s]()=%d", type(raw), len(raw))
- doc = bs4.BeautifulSoup(raw, features='html.parser')
+ doc = bs4.BeautifulSoup(raw, features="html.parser")
logger.debug("doc[]='%s'", type(doc))
except network.exceptions as exception:
logger.warning("Cannot fetch software='%s' from fediverse.observer: '%s'", software, type(exception))
raw = utils.fetch_url("https://raw.githubusercontent.com/chaossocial/meta/master/federation.md", network.web_headers, (config.get("connection_timeout"), config.get("read_timeout"))).text
logger.debug("raw()=%d,raw[]='%s'", len(raw), type(raw))
- doc = bs4.BeautifulSoup(markdown.markdown(raw, extensions=extensions), features='html.parser')
+ doc = bs4.BeautifulSoup(markdown.markdown(raw, extensions=extensions), features="html.parser")
logger.debug("doc()=%d[]='%s'", len(doc), type(doc))
silenced = doc.find("h2", {"id": "silenced-instances"}).findNext("table").find("tbody")
elif software in ["hometown", "ecko"]:
logger.debug("Setting mastodon: software='%s'", software)
software = "mastodon"
- elif software in ["slipfox calckey", "calckey", "groundpolis", "foundkey", "cherrypick", "meisskey", "magnetar", "keybump"]:
+ elif software in ["slipfox calckey", "calckey", "groundpolis", "foundkey", "cherrypick", "meisskey", "magnetar", "keybump", "dolphin"]:
logger.debug("Setting misskey: software='%s'", software)
software = "misskey"
elif software == "runtube.re":