avoid empty metadata comments

This commit is contained in:
msramalho
2025-07-06 14:05:17 +01:00
parent 9d3cd5774b
commit d3efd7121c
2 changed files with 3 additions and 3 deletions

View File

@@ -307,7 +307,7 @@ class GenericExtractor(Extractor):
if "description" in video_data and not result.get("content"):
result.set_content(video_data.get("description"))
# 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(
"comments",
[
@@ -516,7 +516,7 @@ class GenericExtractor(Extractor):
)
return False
if result:
if result and not result.is_success():
extractor_name = "yt-dlp"
if info_extractor:
extractor_name += f"_{info_extractor.ie_key()}"
@@ -535,7 +535,6 @@ class GenericExtractor(Extractor):
if url.startswith("https://ya.ru"):
url = url.replace("https://ya.ru", "https://yandex.ru")
item.set("replaced_url", url)
logger.debug(f"{skip_proxy=}, {self.proxy_on_failure_only=}, {self.proxy=}")
# proxy_on_failure_only logic
if self.proxy and self.proxy_on_failure_only and not skip_proxy:

View File

@@ -141,6 +141,7 @@ class TestTiktokTikwmExtractor(TestExtractorBase):
assert result.get_title() == "Title"
assert result.get("author") == "Author"
assert result.get("other") == "data"
assert result.get("comments") is None
assert result.get("api_data") == {"id": 123, "other": "data"}
assert result.media[1].get("duration") == 60
assert result.get("timestamp") == datetime.fromtimestamp(1736301699, tz=timezone.utc)