stop getting aliased domains
This commit is contained in:
pare
739c8bfb74
commit
fa047b0593
S'han modificat 1 arxius amb 24 adicions i 9 eliminacions
33
getpeers.py
33
getpeers.py
|
@ -47,23 +47,38 @@ def get_peers(peer):
|
||||||
|
|
||||||
user_agent = {'User-agent': "fediverse's stats (fediverse@mastodont.cat)"}
|
user_agent = {'User-agent': "fediverse's stats (fediverse@mastodont.cat)"}
|
||||||
|
|
||||||
response = requests.get('https://' + peer + peers_api, headers = user_agent, timeout=3)
|
domain_res = requests.get('https://' + peer + '/api/v1/instance', headers = user_agent, timeout=3)
|
||||||
|
|
||||||
response_json = response.json()
|
domain_res_json = domain_res.json()
|
||||||
|
|
||||||
if response.status_code == 200:
|
if domain_res.status_code == 200:
|
||||||
|
|
||||||
try:
|
domain_uri = domain_res_json['uri'].replace('https://', '')
|
||||||
|
|
||||||
print(f"Server: {peer}, federated with {str(len(response_json))} servers")
|
if domain_uri != peer:
|
||||||
|
|
||||||
for peer_peer in response_json:
|
print(f'{peer} is an aliased domain of {domain_uri}!')
|
||||||
|
|
||||||
write_server(peer_peer, peer)
|
else:
|
||||||
|
|
||||||
except:
|
response = requests.get('https://' + peer + peers_api, headers = user_agent, timeout=3)
|
||||||
|
|
||||||
|
response_json = response.json()
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
print(f"Server: {peer}, federated with {str(len(response_json))} servers")
|
||||||
|
|
||||||
|
for peer_peer in response_json:
|
||||||
|
|
||||||
|
write_server(peer_peer, peer)
|
||||||
|
|
||||||
|
except:
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
pass
|
|
||||||
except:
|
except:
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Referencia en una nova incidència