stop getting aliased domains

This commit is contained in:
spla 2022-05-11 21:08:44 +02:00
pare 739c8bfb74
commit fa047b0593

Veure arxiu

@ -47,6 +47,20 @@ def get_peers(peer):
user_agent = {'User-agent': "fediverse's stats (fediverse@mastodont.cat)"}
domain_res = requests.get('https://' + peer + '/api/v1/instance', headers = user_agent, timeout=3)
domain_res_json = domain_res.json()
if domain_res.status_code == 200:
domain_uri = domain_res_json['uri'].replace('https://', '')
if domain_uri != peer:
print(f'{peer} is an aliased domain of {domain_uri}!')
else:
response = requests.get('https://' + peer + peers_api, headers = user_agent, timeout=3)
response_json = response.json()
@ -64,6 +78,7 @@ def get_peers(peer):
except:
pass
except:
pass