Revert "Delete src/dev-cli/browser directory"
This reverts commit ff3ceecc37
.
This commit is contained in:
parent
ff3ceecc37
commit
06c48a3804
|
@ -0,0 +1 @@
|
|||
dist
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Scraper CLI</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="./index.ts" type="module"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
import { makeProviders, makeSimpleProxyFetcher, makeStandardFetcher, targets } from '../../../lib';
|
||||
|
||||
(window as any).scrape = (proxyUrl: string, type: 'source' | 'embed', input: any) => {
|
||||
const providers = makeProviders({
|
||||
fetcher: makeStandardFetcher(fetch),
|
||||
target: targets.BROWSER,
|
||||
proxiedFetcher: makeSimpleProxyFetcher(proxyUrl, fetch),
|
||||
});
|
||||
if (type === 'source') {
|
||||
return providers.runSourceScraper(input);
|
||||
}
|
||||
if (type === 'embed') {
|
||||
return providers.runEmbedScraper(input);
|
||||
}
|
||||
|
||||
throw new Error('Input input type');
|
||||
};
|
Loading…
Reference in New Issue