Revert "fix browser cli"

This reverts commit 8504278157.
This commit is contained in:
Pas 2026-01-19 12:24:05 -07:00
parent 8504278157
commit e66b7a2982
2 changed files with 0 additions and 62 deletions

View file

@ -1,11 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dev CLI Browser Mode</title>
</head>
<body>
<script type="module" src="index.ts"></script>
</body>
</html>

View file

@ -1,51 +0,0 @@
import { makeProviders, makeStandardFetcher, targets } from '../../../lib/index.js';
async function scrape(proxy: string, type: 'embed' | 'source', input: any) {
// Set up proxy if provided
let fetcher = makeStandardFetcher(fetch);
if (proxy) {
fetcher = makeStandardFetcher(async (url: string, options?: RequestInit) => {
const response = await fetch(proxy, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
url,
options,
}),
mode: 'no-cors',
});
const data = await response.json();
return new Response(data.body, {
status: data.status,
statusText: data.statusText,
headers: data.headers,
});
});
}
const providers = makeProviders({
fetcher,
target: targets.ANY,
});
if (type === 'embed') {
return providers.runEmbedScraper({
disableOpensubtitles: true,
url: input.url,
id: input.id,
});
}
if (type === 'source') {
return providers.runSourceScraper({
disableOpensubtitles: true,
media: input.media,
id: input.id,
});
}
throw new Error('Invalid scrape type');
}
(window as any).scrape = scrape;