Use undici fetch

This commit is contained in:
SukkaW
2025-01-10 00:50:54 +08:00
parent 0c679645e7
commit 5e40f2cbe0
8 changed files with 22 additions and 23 deletions

View File

@@ -4,15 +4,15 @@ import { HostnameSmolTrie } from './lib/trie';
import path from 'node:path';
import { processLine } from './lib/process-line';
import { SOURCE_DIR } from './constants/dir';
import { $fetch } from './lib/make-fetch-happen';
import { parseFelixDnsmasqFromResp } from './lib/parse-dnsmasq';
import { $$fetch } from './lib/fetch-retry';
export async function parseDomesticList() {
const trie = new HostnameSmolTrie(await parseFelixDnsmasqFromResp(await $fetch('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf')));
const trie = new HostnameSmolTrie(await parseFelixDnsmasqFromResp(await $$fetch('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf')));
const top5000 = new Set<string>();
const res = await (await $fetch('https://radar.cloudflare.com/charts/LargerTopDomainsTable/attachment?id=1077&top=10000', {
const res = await (await $$fetch('https://radar.cloudflare.com/charts/LargerTopDomainsTable/attachment?id=1077&top=10000', {
headers: {
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,es;q=0.5',