一応収集スクリプトおいておくので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}")
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.