Skip to content

Commit

Permalink
fix: ofetch
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Apr 15, 2023
1 parent 7cfda5a commit 730e069
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';

import ofetch from 'ofetch';
import { ofetch } from 'ofetch/node';
import { HttpsProxyAgent } from 'https-proxy-agent';

import { fetchResourcePage } from '../packages/animegarden/src';
Expand All @@ -11,10 +11,11 @@ async function main(start: number, dist: string) {
console.log(`Fetch page ${page}`);

const r = await fetchResourcePage(
ofetch.createFetch({
// @ts-ignore
agent: process.env.HTTPS_PROXY ? new HttpsProxyAgent(process.env.HTTPS_PROXY) : undefined
}),
(url) =>
ofetch.native(url, {
// @ts-ignore
agent: process.env.HTTPS_PROXY ? new HttpsProxyAgent(process.env.HTTPS_PROXY) : undefined
}),
{
page,
retry: Number.MAX_SAFE_INTEGER
Expand Down

0 comments on commit 730e069

Please sign in to comment.