phanpy/scripts/fetch-instances-list.js

13 lines
331 B
JavaScript
Raw Normal View History

2022-12-10 09:14:48 +00:00
import fs from 'fs';
const url = 'https://api.joinmastodon.org/servers';
const results = await fetch(url);
2022-12-10 09:14:48 +00:00
const json = await results.json();
2023-08-22 12:11:28 +00:00
const domains = json.map((instance) => instance.domain);
2022-12-10 09:14:48 +00:00
// Write to file
const path = './src/data/instances.json';
fs.writeFileSync(path, JSON.stringify(domains, null, '\t'), 'utf8');