_get-lum-apex-domains.ts 513 B

1234567891011121314151617
  1. import { fetchRemoteTextByLine } from './lib/fetch-text-by-line';
  2. import tldts from 'tldts';
  3. (async () => {
  4. const lines = await Array.fromAsync(await fetchRemoteTextByLine('https://raw.githubusercontent.com/durablenapkin/block/master/luminati.txt', true));
  5. const set = new Set<string>();
  6. lines.forEach((line) => {
  7. const apexDomain = tldts.getDomain(line.slice(8));
  8. if (apexDomain) {
  9. set.add(apexDomain);
  10. }
  11. });
  12. console.log(Array.from(set).map(line => '.' + line).join('\n'));
  13. })();