From 63664e3c9493dadf2d5266e40d436a1647b1c41c Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:50:19 +0000 Subject: [PATCH] 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 --- videoarchiver/utils/video_downloader.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/videoarchiver/utils/video_downloader.py b/videoarchiver/utils/video_downloader.py index f77ebdf..dc37bff 100644 --- a/videoarchiver/utils/video_downloader.py +++ b/videoarchiver/utils/video_downloader.py @@ -305,17 +305,18 @@ class VideoDownloader: # Get extractors extractors = ydl._ies # Try each extractor - for extractor in extractors: - if hasattr(extractor, '_VALID_URL') and extractor._VALID_URL: - # Skip if site is not enabled - if self.enabled_sites and not any( - site.lower() in extractor.IE_NAME.lower() - for site in self.enabled_sites - ): - continue - # Try to match URL using the class method - if extractor.suitable(url) and not isinstance(extractor.suitable(url), str): - return True + for ie in extractors: + # Skip if site is not enabled + if self.enabled_sites and not any( + site.lower() in ie.IE_NAME.lower() + for site in self.enabled_sites + ): + continue + # Create an instance of the extractor + extractor = ie(ydl) + # Try to match URL + if extractor.suitable(url): + return True return False except Exception as e: logger.error(f"Error checking URL support: {str(e)}")