From cc6434103b6786f5f0e19aca652edee649d4f81f Mon Sep 17 00:00:00 2001 From: Gary James Date: Wed, 3 Aug 2022 17:03:19 +0100 Subject: [PATCH 1/5] Update streams.py --- tap_instagram/streams.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 80cebb4..4442566 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -81,7 +81,6 @@ class MediaStream(InstagramStream): "thumbnail_url", "timestamp", "username", - "video_title", ] # Optionally, you may also use `schema_filepath` in place of `schema`: # schema_filepath = SCHEMAS_DIR / "users.json" From 594ee0b3e6b63db8ceb6df24905930c667be9960 Mon Sep 17 00:00:00 2001 From: Gary James Date: Wed, 3 Aug 2022 17:06:47 +0100 Subject: [PATCH 2/5] Update streams.py --- tap_instagram/streams.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 4442566..6aa7107 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -177,12 +177,6 @@ class MediaStream(InstagramStream): th.StringType, description="Username of user who created the media.", ), - th.Property( - "video_title", - th.StringType, - description="Instagram TV media title. Will not be returned if targeting an Instagram TV video created on " - "or after October 5, 2021.", - ), ).to_dict() def make_since_param(self, context: Optional[dict]) -> datetime: From 9804ea23cc0dafadd8297a40235ef9d55e5d550c Mon Sep 17 00:00:00 2001 From: Gary James Date: Wed, 3 Aug 2022 17:20:09 +0100 Subject: [PATCH 3/5] Update streams.py --- tap_instagram/streams.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 6aa7107..b6c117b 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -467,6 +467,16 @@ def _metrics_for_media_type(media_type: str, media_product_type: str): "taps_forward", "taps_back", ] + elif media_product_type == "REELS": + return [ + "comments", + "likes", + "plays", + "reach", + "saved", + "shares", + "total_interactions", + ] else: # media_product_type is "AD" or "FEED" metrics = [ "engagement", From f3feed671e71af9b35ef11dfdb5a735b6fdb8cab Mon Sep 17 00:00:00 2001 From: Gary James Date: Fri, 12 Aug 2022 12:37:50 +0100 Subject: [PATCH 4/5] fix - primary_keys must be a list --- tap_instagram/streams.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index b6c117b..dd5c41e 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -407,7 +407,7 @@ class MediaInsightsStream(InstagramStream): path = "/{media_id}/insights" parent_stream_type = MediaStream state_partitioning_keys = ["user_id"] - primary_keys = "id" + primary_keys = ["id"] replication_key = None records_jsonpath = "$.data[*]" @@ -581,7 +581,7 @@ class StoryInsightsStream(InstagramStream): path = "/{media_id}/insights" parent_stream_type = StoriesStream state_partitioning_keys = ["user_id"] - primary_keys = "id" + primary_keys = ["id"] replication_key = None records_jsonpath = "$.data[*]" @@ -725,7 +725,7 @@ def parse_response(self, response: requests.Response) -> Iterable[dict]: class UserInsightsStream(InstagramStream): parent_stream_type = UsersStream path = "/{user_id}/insights" # user_id is populated using child context keys from UsersStream - primary_keys = "id" + primary_keys = ["id"] replication_key = "end_time" records_jsonpath = "$.data[*]" has_pagination = True From 5e653aeb41a4a2ca20e5f01b713be4cd8cb70de1 Mon Sep 17 00:00:00 2001 From: Gary James Date: Fri, 12 Aug 2022 13:22:22 +0100 Subject: [PATCH 5/5] fix - remove more video_titles --- tap_instagram/streams.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index dd5c41e..5c3ec97 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -237,7 +237,6 @@ class StoriesStream(InstagramStream): "thumbnail_url", "timestamp", "username", - "video_title", ] # Optionally, you may also use `schema_filepath` in place of `schema`: # schema_filepath = SCHEMAS_DIR / "users.json" @@ -334,12 +333,6 @@ class StoriesStream(InstagramStream): th.StringType, description="Username of user who created the media.", ), - th.Property( - "video_title", - th.StringType, - description="Instagram TV media title. Will not be returned if targeting an Instagram TV video created on " - "or after October 5, 2021.", - ), ).to_dict() def get_url_params( @@ -374,7 +367,7 @@ class MediaChildrenStream(MediaStream): parent_stream_type = MediaStream state_partitioning_keys = ["user_id"] path = "/{media_id}/children" # media_id is populated using child context keys from MediaStream - # caption, comments_count, is_comment_enabled, like_count, media_product_type, video_title + # caption, comments_count, is_comment_enabled, like_count, media_product_type # not available on album children # TODO: Is media_product_type available on children of some media types? carousel vs album children? # https://developers.facebook.com/docs/instagram-api/reference/ig-media#fields