mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 10:51:05 -05:00
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
This commit is contained in:
@@ -293,11 +293,11 @@ class VideoProcessor:
|
|||||||
for word in words:
|
for word in words:
|
||||||
# Try each extractor
|
# Try each extractor
|
||||||
for ie in ydl._ies:
|
for ie in ydl._ies:
|
||||||
# Use suitable as a classmethod and check the result
|
if hasattr(ie, '_VALID_URL') and ie._VALID_URL:
|
||||||
result = ie.suitable(word)
|
# Use regex pattern matching instead of suitable()
|
||||||
if result and not isinstance(result, str):
|
if re.match(ie._VALID_URL, word):
|
||||||
urls.append(word)
|
urls.append(word)
|
||||||
break # Stop once we find a matching extractor
|
break # Stop once we find a matching pattern
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"URL extraction error: {str(e)}")
|
logger.error(f"URL extraction error: {str(e)}")
|
||||||
return list(set(urls)) # Remove duplicates
|
return list(set(urls)) # Remove duplicates
|
||||||
|
|||||||
Reference in New Issue
Block a user