一応収集スクリプトおいておくのでmisskey.04.siのところを変えてご自由にお使いくださいfrom publicsuffix2 import fetch, get_tld import requests from pprint import pprint from time import sleep psl_file = fetch() length = 9000 headers = { 'Content-Type': 'application/json', } hosts = {} cnt = 0 for i in range(0,length + 1,10): json_data = { 'limit': 10, 'offset': i, } response = requests.post('https://misskey.04.si/api/federation/instances', headers=headers, json=json_data).json() if (response == []): break for r in response: cnt+=1 domain = r["host"] tld = get_tld(domain, psl_file=psl_file) print(f"domain:{domain} tld:{tld}") if (tld in hosts): hosts[tld] += 1 else: hosts[tld] = 1 sleep(5) hosts = sorted(hosts.items(),key=lambda x:x[1],reverse=True) with open("result.txt","w") as f: for tld, count in hosts: f.write(f"{tld}: {count}\n") pprint(hosts) print(f"total server:{cnt}")
Conversation
Notices
-
Embed this notice
GrapeApple@管理人:verified: (grapeapple@misskey.04.si)'s status on Tuesday, 22-Aug-2023 16:52:32 JST GrapeApple@管理人:verified: - naskya::dev likes this.
-
Embed this notice
:vc: RooteilrahC (relay@yugabytedon.hakurei.win)'s status on Tuesday, 22-Aug-2023 17:43:24 JST :vc: RooteilrahC @grapeapple テキストファイルから処理したかったからこれを改造した
https://gist.github.com/WinLinux1028/1e3e3cd8bdfabfb05e40d9b6f685c560 -
Embed this notice
:vc: RooteilrahC (relay@yugabytedon.hakurei.win)'s status on Tuesday, 22-Aug-2023 17:44:31 JST :vc: RooteilrahC @grapeapple ついでにExcelで処理しやすいように出力をCSVにした
In conversation permalink