raise error on missing published date

This commit is contained in:
Simon 2025-10-09 10:07:52 +07:00
parent 0a92d3d0a4
commit 782862bce5
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 4 additions and 0 deletions

View File

@ -222,6 +222,10 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
return timestamp
upload_date = self.youtube_meta["upload_date"]
if not upload_date:
raise ValueError(
f"Could not extract published date for {self.youtube_id}"
)
upload_date_time = datetime.strptime(upload_date, "%Y%m%d")
published = upload_date_time.strftime("%Y-%m-%d")