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:
pacnpal
2024-11-15 02:13:37 +00:00
parent 1b64991041
commit a16b1ea7a4
2 changed files with 59 additions and 49 deletions

View File

@@ -197,7 +197,7 @@ class VideoArchiverCommands(commands.Cog):
# Verify sites are valid
with yt_dlp.YoutubeDL() as ydl:
valid_sites = set(ie.IE_NAME.lower() for ie in ydl._ies)
valid_sites = set(ie.IE_NAME.lower() for ie in ydl._ies if hasattr(ie, 'IE_NAME'))
invalid_sites = [s for s in site_list if s not in valid_sites]
if invalid_sites:
await ctx.send(
@@ -217,7 +217,8 @@ class VideoArchiverCommands(commands.Cog):
embed = discord.Embed(title="Video Sites Configuration", color=discord.Color.blue())
with yt_dlp.YoutubeDL() as ydl:
all_sites = sorted(ie.IE_NAME for ie in ydl._ies if ie.IE_NAME is not None)
# Filter out any extractors that don't have IE_NAME attribute
all_sites = sorted(ie.IE_NAME for ie in ydl._ies if hasattr(ie, 'IE_NAME') and ie.IE_NAME is not None)
# Split sites into chunks for Discord's field value limit
chunk_size = 20