adds post_data to metadata for instagram

This commit is contained in:
msramalho
2025-06-26 15:48:10 +01:00
parent ce4d7ac649
commit ad29cb4447

View File

@@ -170,13 +170,15 @@ class InstagramAPIExtractor(Extractor):
result.set("#highlights", count_highlights)
return count_highlights
def download_post(self, result: Metadata, code: str = None, id: str = None, context: str = None) -> Metadata:
def download_post(self, result: Metadata, code: str = None, id: str = None, context: str = "") -> Metadata:
if id:
post = self.call_api("v1/media/by/id", {"id": id})
else:
post = self.call_api("v1/media/by/code", {"code": code})
assert post, f"Post {id or code} not found"
result.set(f"{context}_data", post)
if caption_text := post.get("caption_text"):
result.set_title(caption_text)