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