2022-12-10 09:14:48 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
|
2024-02-17 08:49:50 +00:00
|
|
|
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
|
|
|
|
2024-02-17 08:49:50 +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';
|
2024-02-17 08:49:50 +00:00
|
|
|
fs.writeFileSync(path, JSON.stringify(domains, null, '\t'), 'utf8');
|