mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 10:51:05 -05:00
fix: URL extraction error in is_supported_url method
- Fixed 'str' object has no attribute 'suitable' error - Now properly instantiating extractors before calling suitable() - Improved error handling in URL validation
This commit is contained in:
@@ -305,17 +305,18 @@ class VideoDownloader:
|
|||||||
# Get extractors
|
# Get extractors
|
||||||
extractors = ydl._ies
|
extractors = ydl._ies
|
||||||
# Try each extractor
|
# Try each extractor
|
||||||
for extractor in extractors:
|
for ie in extractors:
|
||||||
if hasattr(extractor, '_VALID_URL') and extractor._VALID_URL:
|
# Skip if site is not enabled
|
||||||
# Skip if site is not enabled
|
if self.enabled_sites and not any(
|
||||||
if self.enabled_sites and not any(
|
site.lower() in ie.IE_NAME.lower()
|
||||||
site.lower() in extractor.IE_NAME.lower()
|
for site in self.enabled_sites
|
||||||
for site in self.enabled_sites
|
):
|
||||||
):
|
continue
|
||||||
continue
|
# Create an instance of the extractor
|
||||||
# Try to match URL using the class method
|
extractor = ie(ydl)
|
||||||
if extractor.suitable(url) and not isinstance(extractor.suitable(url), str):
|
# Try to match URL
|
||||||
return True
|
if extractor.suitable(url):
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error checking URL support: {str(e)}")
|
logger.error(f"Error checking URL support: {str(e)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user