Switching from regex patterns to yt-dlp simulation for URL detection:

Removed the regex-based URL detection
Added proper yt-dlp simulation to check if URLs are supported
Added better error handling for URL checking
Added detailed logging of URL detection results
Improving FFmpeg integration:

Added proper ffprobe binary download alongside FFmpeg
Added better verification of both binaries
Added retry mechanisms for binary downloads
Added proper cleanup of failed downloads
Enhancing error handling and logging:

Added detailed logging throughout the system
Added better error recovery mechanisms
Added proper cleanup of temporary files
Added better tracking of failed operations
This commit is contained in:
pacnpal
2024-11-15 03:40:53 +00:00
parent 8503fc6fdd
commit 3e50faec75
3 changed files with 128 additions and 111 deletions

View File

@@ -316,15 +316,22 @@ class VideoProcessor:
if monitored_channels and message.channel.id not in monitored_channels:
return
# Find all video URLs in message with improved pattern matching
# Find all video URLs in message using yt-dlp simulation
logger.info(f"Checking message {message.id} for video URLs...")
urls = []
if message.guild.id in self.components:
downloader = self.components[message.guild.id]["downloader"]
if downloader:
# Check each word in the message
for word in message.content.split():
if downloader.is_supported_url(word):
urls.append(word)
# Use yt-dlp simulation to check if URL is supported
try:
if downloader.is_supported_url(word):
logger.info(f"Found supported URL: {word}")
urls.append(word)
except Exception as e:
logger.error(f"Error checking URL {word}: {str(e)}")
continue
if urls:
logger.info(f"Found {len(urls)} video URLs in message {message.id}")