this repo has no description
at hotfix/infinite-loop-intersection-observer 20 lines 620 B view raw
1import fs from 'fs'; 2 3const url = 'https://mastodon.social/'; 4 5const html = await fetch(url).then((res) => res.text()); 6 7// Extract the JSON between <script id="initial-state" type="application/json"></script> 8const json = html.match( 9 /<script id="initial-state" type="application\/json">(.*)<\/script>/, 10)[1]; 11 12const initialState = JSON.parse(json); 13const { languages } = initialState; 14 15console.log(`Found ${languages.length} languages`); 16 17// Write to file 18const path = './src/data/status-supported-languages.json'; 19fs.writeFileSync(path, JSON.stringify(languages, null, '\t'), 'utf8'); 20console.log(`Wrote ${path}`);