From a57722846527efe61c9e2ebd28bdff7f3d4bc25d Mon Sep 17 00:00:00 2001 From: erinhmclark Date: Tue, 18 Mar 2025 21:10:06 +0000 Subject: [PATCH] Update generic_extractor.py for general/ youtube extraction. --- .../modules/generic_extractor/generic_extractor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/auto_archiver/modules/generic_extractor/generic_extractor.py b/src/auto_archiver/modules/generic_extractor/generic_extractor.py index e7b75d9..6a9e28f 100644 --- a/src/auto_archiver/modules/generic_extractor/generic_extractor.py +++ b/src/auto_archiver/modules/generic_extractor/generic_extractor.py @@ -203,7 +203,7 @@ class GenericExtractor(Extractor): if not result.get("url"): result.set_url(url) - if "description" in video_data and not result.get_content(): + if "description" in video_data and not result.get("content"): result.set_content(video_data["description"]) # extract comments if enabled if self.comments: @@ -220,10 +220,13 @@ class GenericExtractor(Extractor): ) # then add the common metadata - if timestamp := video_data.pop("timestamp", None) and not result.get("timestamp"): + timestamp = video_data.pop("timestamp", None) + if timestamp and not result.get("timestamp"): timestamp = datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc).isoformat() result.set_timestamp(timestamp) - if upload_date := video_data.pop("upload_date", None) and not result.get("upload_date"): + + upload_date = video_data.pop("upload_date", None) + if upload_date and not result.get("upload_date"): upload_date = get_datetime_from_str(upload_date, "%Y%m%d").replace(tzinfo=datetime.timezone.utc) result.set("upload_date", upload_date)