phanpy/scripts/fetch-instances-list.js

13 lines
331 B
JavaScript
Raw Normal View History

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