From 8504278157d9f20ad0e641b57c317a2e99355a5b Mon Sep 17 00:00:00 2001
From: Pas <74743263+Pasithea0@users.noreply.github.com>
Date: Mon, 19 Jan 2026 12:15:11 -0700
Subject: [PATCH] fix browser cli
---
src/dev-cli/browser/index.html | 11 ++++++++
src/dev-cli/browser/index.ts | 51 ++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 src/dev-cli/browser/index.html
create mode 100644 src/dev-cli/browser/index.ts
diff --git a/src/dev-cli/browser/index.html b/src/dev-cli/browser/index.html
new file mode 100644
index 0000000..562b2f5
--- /dev/null
+++ b/src/dev-cli/browser/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Dev CLI Browser Mode
+
+
+
+
+
diff --git a/src/dev-cli/browser/index.ts b/src/dev-cli/browser/index.ts
new file mode 100644
index 0000000..9b84d71
--- /dev/null
+++ b/src/dev-cli/browser/index.ts
@@ -0,0 +1,51 @@
+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;