diff --git a/src/viewer/index.html b/src/viewer/index.html
index 64cc871..e738d7a 100644
--- a/src/viewer/index.html
+++ b/src/viewer/index.html
@@ -9,7 +9,7 @@
Goon Plugin
-
+
diff --git a/src/viewer/index.js b/src/viewer/index.js
index b8d8698..2c5e70f 100644
--- a/src/viewer/index.js
+++ b/src/viewer/index.js
@@ -75,7 +75,7 @@ function showActions() {
});
}
-/* === "Find Videos" — scan up to 4 tabs === */
+/* === "Find Videos" — scan all tabs in the window === */
findBtn.addEventListener('click', async () => {
setStatus('Scanning tabs…');
@@ -97,8 +97,7 @@ findBtn.addEventListener('click', async () => {
return;
}
- // Limit to 4 tabs
- const tabsToScan = validTabs.slice(0, 4);
+ const tabsToScan = validTabs;
setStatus(`Scanning ${tabsToScan.length} tab(s)…`);
try {
@@ -114,18 +113,25 @@ findBtn.addEventListener('click', async () => {
return { videos, videoCount, sources, audios };
};
const results = await Promise.all(
- tabsToScan.map(t => chrome.scripting.executeScript({
- target: { tabId: t.id, allFrames: true },
- func: scrapeFn,
- }))
+ tabsToScan.map(async t => {
+ try {
+ return await chrome.scripting.executeScript({
+ target: { tabId: t.id, allFrames: true },
+ func: scrapeFn,
+ });
+ } catch {
+ console.warn('[goon] skipping tab', t.id, ':', t.url);
+ return null;
+ }
+ })
);
// Dedup across all tabs by (src+poster) key
- // Each tab's results array is grouped with its tab title
const tabResults = tabsToScan.map((tab, i) => ({
tabTitle: tab.title || 'Unknown',
frames: results[i]?.filter(Boolean) || [],
- }));
+ })).filter(g => g.frames.length > 0);
+ const scanned = tabResults.length;
const seen = new Map();
let totalFound = 0;
@@ -152,7 +158,7 @@ findBtn.addEventListener('click', async () => {
[TAGGED_KEY]: items.map(v => v.tab),
});
- setStatus(`Found ${items.length} video(s) across ${tabsToScan.length} tab(s).`);
+ setStatus(`Found ${items.length} video(s) across ${scanned} tab(s).`);
renderList(items.map(v => ({ url: v.url, label: v.tab })));
btnRow.style.display = 'flex';
} catch (e) {