mirror of
https://github.com/p-stream/providers.git
synced 2026-05-18 23:42:05 +00:00
Revert "Delete src/dev-cli/browser directory"
This reverts commit ff3ceecc37.
This commit is contained in:
parent
ff3ceecc37
commit
06c48a3804
3 changed files with 29 additions and 0 deletions
1
src/dev-cli/browser/.gitignore
vendored
Normal file
1
src/dev-cli/browser/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
dist
|
||||||
11
src/dev-cli/browser/index.html
Normal file
11
src/dev-cli/browser/index.html
Normal file
|
|
@ -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>
|
||||||
17
src/dev-cli/browser/index.ts
Normal file
17
src/dev-cli/browser/index.ts
Normal file
|
|
@ -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 a new issue