kopia lustrzana https://github.com/bellingcat/auto-archiver
Update generic_extractor.py for general/ youtube extraction.
rodzic
7d972ee9b8
commit
a577228465
|
@ -203,7 +203,7 @@ class GenericExtractor(Extractor):
|
||||||
if not result.get("url"):
|
if not result.get("url"):
|
||||||
result.set_url(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"])
|
result.set_content(video_data["description"])
|
||||||
# extract comments if enabled
|
# extract comments if enabled
|
||||||
if self.comments:
|
if self.comments:
|
||||||
|
@ -220,10 +220,13 @@ class GenericExtractor(Extractor):
|
||||||
)
|
)
|
||||||
|
|
||||||
# then add the common metadata
|
# 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()
|
timestamp = datetime.datetime.fromtimestamp(timestamp, tz=datetime.timezone.utc).isoformat()
|
||||||
result.set_timestamp(timestamp)
|
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)
|
upload_date = get_datetime_from_str(upload_date, "%Y%m%d").replace(tzinfo=datetime.timezone.utc)
|
||||||
result.set("upload_date", upload_date)
|
result.set("upload_date", upload_date)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue