mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
avoid empty metadata comments
This commit is contained in:
@@ -307,7 +307,7 @@ class GenericExtractor(Extractor):
|
|||||||
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.get("description"))
|
result.set_content(video_data.get("description"))
|
||||||
# extract comments if enabled
|
# extract comments if enabled
|
||||||
if self.comments and video_data.get("comments", []) is not None:
|
if self.comments and video_data.get("comments", None) is not None:
|
||||||
result.set(
|
result.set(
|
||||||
"comments",
|
"comments",
|
||||||
[
|
[
|
||||||
@@ -516,7 +516,7 @@ class GenericExtractor(Extractor):
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if result:
|
if result and not result.is_success():
|
||||||
extractor_name = "yt-dlp"
|
extractor_name = "yt-dlp"
|
||||||
if info_extractor:
|
if info_extractor:
|
||||||
extractor_name += f"_{info_extractor.ie_key()}"
|
extractor_name += f"_{info_extractor.ie_key()}"
|
||||||
@@ -535,7 +535,6 @@ class GenericExtractor(Extractor):
|
|||||||
if url.startswith("https://ya.ru"):
|
if url.startswith("https://ya.ru"):
|
||||||
url = url.replace("https://ya.ru", "https://yandex.ru")
|
url = url.replace("https://ya.ru", "https://yandex.ru")
|
||||||
item.set("replaced_url", url)
|
item.set("replaced_url", url)
|
||||||
logger.debug(f"{skip_proxy=}, {self.proxy_on_failure_only=}, {self.proxy=}")
|
|
||||||
|
|
||||||
# proxy_on_failure_only logic
|
# proxy_on_failure_only logic
|
||||||
if self.proxy and self.proxy_on_failure_only and not skip_proxy:
|
if self.proxy and self.proxy_on_failure_only and not skip_proxy:
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ class TestTiktokTikwmExtractor(TestExtractorBase):
|
|||||||
assert result.get_title() == "Title"
|
assert result.get_title() == "Title"
|
||||||
assert result.get("author") == "Author"
|
assert result.get("author") == "Author"
|
||||||
assert result.get("other") == "data"
|
assert result.get("other") == "data"
|
||||||
|
assert result.get("comments") is None
|
||||||
assert result.get("api_data") == {"id": 123, "other": "data"}
|
assert result.get("api_data") == {"id": 123, "other": "data"}
|
||||||
assert result.media[1].get("duration") == 60
|
assert result.media[1].get("duration") == 60
|
||||||
assert result.get("timestamp") == datetime.fromtimestamp(1736301699, tz=timezone.utc)
|
assert result.get("timestamp") == datetime.fromtimestamp(1736301699, tz=timezone.utc)
|
||||||
|
|||||||
Reference in New Issue
Block a user