diff --git a/local-scrapers-repo b/local-scrapers-repo
index 10a18e68..a251769b 160000
--- a/local-scrapers-repo
+++ b/local-scrapers-repo
@@ -1 +1 @@
-Subproject commit 10a18e6867d4600851c8b263a2d82665298b3990
+Subproject commit a251769bedb4ab2f1f983e2c2a216041c664780a
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index d0364cfd..5a4738c6 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -40,6 +40,7 @@ export interface AppSettings {
scraperRepositoryUrl: string; // URL to the scraper repository
enableLocalScrapers: boolean; // Enable/disable local scraper functionality
scraperTimeout: number; // Timeout for scraper execution in seconds
+ enableScraperUrlValidation: boolean; // Enable/disable URL validation for scrapers
}
export const DEFAULT_SETTINGS: AppSettings = {
@@ -62,6 +63,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
scraperRepositoryUrl: '',
enableLocalScrapers: true,
scraperTimeout: 60, // 60 seconds timeout
+ enableScraperUrlValidation: true, // Enable URL validation by default
};
const SETTINGS_STORAGE_KEY = 'app_settings';
diff --git a/src/screens/ScraperSettingsScreen.tsx b/src/screens/ScraperSettingsScreen.tsx
index e21997ca..f1fbefc8 100644
--- a/src/screens/ScraperSettingsScreen.tsx
+++ b/src/screens/ScraperSettingsScreen.tsx
@@ -177,6 +177,10 @@ const ScraperSettingsScreen: React.FC = () => {
await updateSetting('enableLocalScrapers', enabled);
};
+ const handleToggleUrlValidation = async (enabled: boolean) => {
+ await updateSetting('enableScraperUrlValidation', enabled);
+ };
+
const renderScraperItem = (scraper: ScraperInfo) => (
@@ -232,6 +236,22 @@ const ScraperSettingsScreen: React.FC = () => {
thumbColor={settings.enableLocalScrapers ? '#ffffff' : '#f4f3f4'}
/>
+
+ {/* URL Validation Toggle */}
+
+
+ Enable URL Validation
+
+ Validate streaming URLs before returning them (may slow down results but improves reliability)
+
+
+
+
{/* Repository Configuration */}
diff --git a/src/services/localScraperService.ts b/src/services/localScraperService.ts
index 913e231b..12f91382 100644
--- a/src/services/localScraperService.ts
+++ b/src/services/localScraperService.ts
@@ -294,6 +294,11 @@ class LocalScraperService {
private async executeSandboxed(code: string, params: any): Promise {
// This is a simplified sandbox - in production, you'd want more security
try {
+ // Get URL validation setting from AsyncStorage
+ const settingsData = await AsyncStorage.getItem('app_settings');
+ const settings = settingsData ? JSON.parse(settingsData) : {};
+ const urlValidationEnabled = settings.enableScraperUrlValidation ?? true;
+
// Create a limited global context
const moduleExports = {};
const moduleObj = { exports: moduleExports };
@@ -373,7 +378,9 @@ class LocalScraperService {
// Node.js compatibility
module: moduleObj,
exports: moduleExports,
- global: {} // Empty global object
+ global: {}, // Empty global object
+ // URL validation setting
+ URL_VALIDATION_ENABLED: urlValidationEnabled
};
// Execute the scraper code with timeout
@@ -385,7 +392,7 @@ class LocalScraperService {
try {
// Create function from code
const func = new Function('sandbox', 'params', `
- const { console, setTimeout, clearTimeout, Promise, JSON, Date, Math, parseInt, parseFloat, encodeURIComponent, decodeURIComponent, require, axios, fetch, module, exports, global } = sandbox;
+ const { console, setTimeout, clearTimeout, Promise, JSON, Date, Math, parseInt, parseFloat, encodeURIComponent, decodeURIComponent, require, axios, fetch, module, exports, global, URL_VALIDATION_ENABLED } = sandbox;
${code}
// Call the main function (assuming it's exported)