From 1b75c3b4bcc839efb5314080073fcc0b2f599d31 Mon Sep 17 00:00:00 2001 From: Mint <> Date: Tue, 23 Aug 2022 22:56:09 +0300 Subject: [PATCH] Add aonther nodeinfo endpoint used by Friendica --- fetch_blocks.py | 2 ++ fetch_instances.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fetch_blocks.py b/fetch_blocks.py index 94e272a..b12a5e3 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -87,6 +87,8 @@ def get_hash(domain: str) -> str: def get_type(domain: str) -> str: try: res = get(f"https://{domain}/nodeinfo/2.1.json", headers=headers, timeout=5) + if res.status_code == 404: + res = get(f"https://{domain}/nodeinfo/2.0", headers=headers, timeout=5) if res.status_code == 404: res = get(f"https://{domain}/nodeinfo/2.0.json", headers=headers, timeout=5) if res.ok and "text/html" in res.headers["content-type"]: diff --git a/fetch_instances.py b/fetch_instances.py index db90170..d3434c7 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -27,6 +27,8 @@ peerlist = get_peers(domain) def get_type(instdomain: str) -> str: try: res = get(f"https://{instdomain}/nodeinfo/2.1.json", headers=headers, timeout=5) + if res.status_code == 404: + res = get(f"https://{instdomain}/nodeinfo/2.0", headers=headers, timeout=5) if res.status_code == 404: res = get(f"https://{instdomain}/nodeinfo/2.0.json", headers=headers, timeout=5) if res.ok and "text/html" in res.headers["content-type"]: -- 2.39.5