From 1b64991041ffec8c89e75c2a1dfd9ab3f8dc81f6 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 15 Nov 2024 02:03:23 +0000 Subject: [PATCH] fix: Change URL extraction in processor to use regex - Replaced extractor.suitable() with direct regex pattern matching - Added check for _VALID_URL attribute - Improved error handling in URL extraction - Maintains compatibility with video_downloader.py changes --- videoarchiver/processor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/videoarchiver/processor.py b/videoarchiver/processor.py index 8198d20..c008bf0 100644 --- a/videoarchiver/processor.py +++ b/videoarchiver/processor.py @@ -293,11 +293,11 @@ class VideoProcessor: for word in words: # Try each extractor for ie in ydl._ies: - # Use suitable as a classmethod and check the result - result = ie.suitable(word) - if result and not isinstance(result, str): - urls.append(word) - break # Stop once we find a matching extractor + if hasattr(ie, '_VALID_URL') and ie._VALID_URL: + # Use regex pattern matching instead of suitable() + if re.match(ie._VALID_URL, word): + urls.append(word) + break # Stop once we find a matching pattern except Exception as e: logger.error(f"URL extraction error: {str(e)}") return list(set(urls)) # Remove duplicates