fix not downloading
This commit is contained in:
@@ -247,7 +247,7 @@ class AniworldLoader(Loader):
|
||||
link, header = self._get_direct_link_from_provider(
|
||||
season, episode, key, language
|
||||
)
|
||||
logging.debug(f"Direct link obtained from provider")
|
||||
logging.debug("Direct link obtained from provider")
|
||||
ydl_opts = {
|
||||
'fragment_retries': float('inf'),
|
||||
'outtmpl': temp_path,
|
||||
@@ -259,22 +259,36 @@ class AniworldLoader(Loader):
|
||||
|
||||
if header:
|
||||
ydl_opts['http_headers'] = header
|
||||
logging.debug(f"Using custom headers for download")
|
||||
logging.debug("Using custom headers for download")
|
||||
if progress_callback:
|
||||
ydl_opts['progress_hooks'] = [progress_callback]
|
||||
|
||||
logging.debug(f"Starting YoutubeDL download")
|
||||
with YoutubeDL(ydl_opts) as ydl:
|
||||
ydl.download([link])
|
||||
try:
|
||||
logging.debug("Starting YoutubeDL download")
|
||||
with YoutubeDL(ydl_opts) as ydl:
|
||||
ydl.download([link])
|
||||
|
||||
if os.path.exists(temp_path):
|
||||
logging.debug(f"Moving file from temp to final destination")
|
||||
shutil.copy(temp_path, output_path)
|
||||
os.remove(temp_path)
|
||||
logging.info(f"Download completed successfully: {output_file}")
|
||||
if os.path.exists(temp_path):
|
||||
logging.debug("Moving file from temp to final destination")
|
||||
shutil.copy(temp_path, output_path)
|
||||
os.remove(temp_path)
|
||||
logging.info(f"Download completed successfully: {output_file}")
|
||||
self.clear_cache()
|
||||
return True
|
||||
else:
|
||||
logging.error(f"Download failed: temp file not found at {temp_path}")
|
||||
self.clear_cache()
|
||||
return False
|
||||
except Exception as e:
|
||||
logging.error(f"YoutubeDL download failed: {e}")
|
||||
# Try next provider if available
|
||||
continue
|
||||
break
|
||||
|
||||
# If we get here, all providers failed
|
||||
logging.error("All download providers failed")
|
||||
self.clear_cache()
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_site_key(self) -> str:
|
||||
"""Get the site key for this provider."""
|
||||
|
||||
Reference in New Issue
Block a user