Start building a provider scrape system

This commit is contained in:
mrjvs
2023-08-23 17:56:18 +02:00
parent 80f7cbce0c
commit 61ee0e13fa
10 changed files with 69 additions and 6 deletions

6
src/utils/context.ts Normal file
View File

@@ -0,0 +1,6 @@
import { Fetcher } from '@/utils/fetcher';
export interface ScrapeContext {
proxiedFetcher: Fetcher;
fetcher: Fetcher;
}

11
src/utils/fetcher.ts Normal file
View File

@@ -0,0 +1,11 @@
export type FetcherOptions = {
baseUrl?: string;
headers?: Record<string, string>;
query?: Record<string, string>;
method?: 'GET' | 'POST';
body?: Record<string, any> | string | FormData;
};
export type Fetcher<T = any> = {
(url: string, ops?: FetcherOptions): T;
};