handle embed error

This commit is contained in:
Simon 2025-10-29 19:01:56 +07:00
parent 815790e397
commit 79d994e460
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 7 additions and 0 deletions

View File

@ -431,9 +431,16 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
if not self.json_data:
self.get_from_es()
if not self.json_data:
print(f"{self.youtube_id}: skip embed, video not indexed")
return
video_base = EnvironmentSettings.MEDIA_DIR
media_url = self.json_data.get("media_url")
file_path = os.path.join(video_base, media_url)
if not os.path.exists(file_path):
print(f"{self.youtube_id}: skip embed, file not found")
return
title = self.json_data["title"]
artist = self.json_data["channel"]["channel_name"]