From 7acb82f2bc8ed5c62879da0f92ddaa959bc11010 Mon Sep 17 00:00:00 2001 From: diwakarkasi <86729292+dkasi938@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:08:01 -0500 Subject: [PATCH 1/2] Remove audience demographic fields --- tap_instagram/streams.py | 24 ++++++++++++------------ tap_instagram/tap.py | 2 -- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index f3ead37..904e476 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -872,18 +872,18 @@ class UserInsightsOnlineFollowersStream(UserInsightsStream): # TODO: Add note about online_followers seemingly only going back 30 days -class UserInsightsAudienceStream(UserInsightsStream): - """Define custom stream.""" - - name = "user_insights_audience" - metrics = [ - "audience_city", - "audience_country", - "audience_gender_age", - "audience_locale", - ] - time_period = "lifetime" - has_pagination = False +# class UserInsightsAudienceStream(UserInsightsStream): +# """Define custom stream.""" +# +# name = "user_insights_audience" +# metrics = [ +# "audience_city", +# "audience_country", +# "audience_gender_age", +# "audience_locale", +# ] +# time_period = "lifetime" +# has_pagination = False class UserInsightsFollowersStream(UserInsightsStream): diff --git a/tap_instagram/tap.py b/tap_instagram/tap.py index d524ae2..57085c0 100644 --- a/tap_instagram/tap.py +++ b/tap_instagram/tap.py @@ -13,7 +13,6 @@ StoriesStream, StoryInsightsStream, UserInsights28DayStream, - UserInsightsAudienceStream, UserInsightsDailyStream, UserInsightsFollowersStream, UserInsightsOnlineFollowersStream, @@ -28,7 +27,6 @@ StoriesStream, StoryInsightsStream, UserInsights28DayStream, - UserInsightsAudienceStream, UserInsightsDailyStream, UserInsightsFollowersStream, UserInsightsOnlineFollowersStream, From 9c1943873994abf59da95900fa1fe189525d2ef9 Mon Sep 17 00:00:00 2001 From: diwakarkasi <86729292+dkasi938@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:53:23 -0500 Subject: [PATCH 2/2] Additional changes. https://developers.facebook.com/docs/instagram-api/reference/ig-media/insights --- tap_instagram/streams.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tap_instagram/streams.py b/tap_instagram/streams.py index 904e476..4d3c3fd 100644 --- a/tap_instagram/streams.py +++ b/tap_instagram/streams.py @@ -472,7 +472,7 @@ def _metrics_for_media_type(media_type: str, media_product_type: str): ] else: # media_product_type is "AD" or "FEED" metrics = [ - "engagement", + "total_interactions", "impressions", "reach", "saved", @@ -482,11 +482,11 @@ def _metrics_for_media_type(media_type: str, media_product_type: str): return metrics elif media_type == "CAROUSEL_ALBUM": return [ - "carousel_album_engagement", - "carousel_album_impressions", - "carousel_album_reach", - "carousel_album_saved", - "carousel_album_video_views", + "total_interactions", + "impressions", + "reach", + "saved", + "video_views", ] else: raise ValueError( @@ -629,16 +629,16 @@ def _metrics_for_media_type(media_type: str, media_product_type: str): if media_type in ("IMAGE", "VIDEO"): if media_product_type == "STORY": return [ - "exits", + # "exits", "impressions", "reach", "replies", - "taps_forward", - "taps_back", + # "taps_forward", + # "taps_back", ] else: # media_product_type is "AD" or "FEED" metrics = [ - "engagement", + "total_interactions", "impressions", "reach", "saved", @@ -648,11 +648,11 @@ def _metrics_for_media_type(media_type: str, media_product_type: str): return metrics elif media_type == "CAROUSEL_ALBUM": return [ - "carousel_album_engagement", - "carousel_album_impressions", - "carousel_album_reach", - "carousel_album_saved", - "carousel_album_video_views", + "total_interactions", + "impressions", + "reach", + "saved", + "video_views", ] else: raise ValueError(