Skip to content

Commit

Permalink
🎉 Source Facebook: add the "videos" stream. (airbytehq#7855)
Browse files Browse the repository at this point in the history
* Source Facebook: add the "videos" stream.

* bump the version

* run seed and update doc

Co-authored-by: Marcos Marx <[email protected]>
  • Loading branch information
zestyping and marcosmarxm authored Nov 19, 2021
1 parent bec3b3b commit aac54da
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sourceDefinitionId": "e7778cfc-e97c-4458-9ecb-b4f2bba8946c",
"name": "Facebook Marketing",
"dockerRepository": "airbyte/source-facebook-marketing",
"dockerImageTag": "0.2.24",
"dockerImageTag": "0.2.26",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/facebook-marketing",
"icon": "facebook.svg"
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
- name: Facebook Marketing
sourceDefinitionId: e7778cfc-e97c-4458-9ecb-b4f2bba8946c
dockerRepository: airbyte/source-facebook-marketing
dockerImageTag: 0.2.25
dockerImageTag: 0.2.26
documentationUrl: https://docs.airbyte.io/integrations/sources/facebook-marketing
icon: facebook.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@
supportsNormalization: false
supportsDBT: false
supported_destination_sync_modes: []
- dockerImage: "airbyte/source-facebook-marketing:0.2.25"
- dockerImage: "airbyte/source-facebook-marketing:0.2.26"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/facebook-marketing"
changelogUrl: "https://docs.airbyte.io/integrations/sources/facebook-marketing"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.25
LABEL io.airbyte.version=0.2.26
LABEL io.airbyte.name=airbyte/source-facebook-marketing
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"properties": {
"id": {
"type": "string"
},
"ad_breaks": {
"type": ["null", "array"],
"items": {
"type": "integer"
}
},
"backdated_time": {
"type": "string",
"format": "date-time"
},
"backdated_time_granularity": {
"type": ["null", "string"]
},
"content_category": {
"type": ["null", "string"]
},
"content_tags": {
"type": ["null", "array"],
"items": {
"type": "string"
}
},
"created_time": {
"type": "string",
"format": "date-time"
},
"custom_labels": {
"type": ["null", "array"],
"items": {
"type": "string"
}
},
"description": {
"type": ["null", "string"]
},
"embed_html": {
"type": ["null", "string"]
},
"embeddable": {
"type": ["null", "boolean"]
},
"format": {
"type": ["null", "array"],
"items": {
"filter": "string",
"embed_html": "string",
"width": "integer",
"height": "integer",
"picture": "string"
}
},
"icon": {
"type": ["null", "string"]
},
"is_crosspost_video": {
"type": ["null", "boolean"]
},
"is_crossposting_eligible": {
"type": ["null", "boolean"]
},
"is_episode": {
"type": ["null", "boolean"]
},
"is_instagram_eligible": {
"type": ["null", "boolean"]
},
"length": {
"type": "number"
},
"live_status": {
"type": "string"
},
"permalink_url": {
"type": ["null", "string"]
},
"post_views": {
"type": ["null", "integer"]
},
"premiere_living_room_status": {
"type": ["null", "boolean"]
},
"published": {
"type": ["null", "boolean"]
},
"scheduled_publish_time": {
"type": "string",
"format": "date-time"
},
"source": {
"type": ["null", "string"]
},
"title": {
"type": ["null", "string"]
},
"universal_video_id": {
"type": ["null", "string"]
},
"updated_time": {
"type": "string",
"format": "date-time"
},
"views": {
"type": ["null", "integer"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
Campaigns,
Videos,
)

logger = logging.getLogger("airbyte")
Expand Down Expand Up @@ -144,6 +145,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Type[Stream]]:
AdsInsightsDma(**insights_args),
AdsInsightsPlatformAndDevice(**insights_args),
AdsInsightsActionType(**insights_args),
Videos(api=api, start_date=config.start_date, end_date=config.end_date, include_deleted=config.include_deleted),
]

return self._update_insights_streams(insights=config.custom_insights, args=insights_args, streams=streams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ def _read_records(self, params: Mapping[str, Any]):
return self._api.account.get_campaigns(params=params)


class Videos(FBMarketingIncrementalStream):
"""See: https://developers.facebook.com/docs/marketing-api/reference/video"""

entity_prefix = "video"
enable_deleted = True

@backoff_policy
def _read_records(self, params: Mapping[str, Any]) -> Iterator:
return self._api.account.get_ad_videos(params=params)


class AdsInsights(FBMarketingIncrementalStream):
"""doc: https://developers.facebook.com/docs/marketing-api/insights"""

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/facebook-marketing.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ As a summary, custom insights allows to replicate only some fields, resulting in

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.2.26 | 2021-11-19 | [7855](https://github.com/airbytehq/airbyte/pull/7855) | Add Video stream |
| 0.2.25 | 2021-11-12 | [7904](https://github.com/airbytehq/airbyte/pull/7904) | Implement retry logic for async jobs |
| 0.2.24 | 2021-11-09 | [7744](https://github.com/airbytehq/airbyte/pull/7744) | Fix fail when async job takes too long |
| 0.2.23 | 2021-11-08 | [7734](https://github.com/airbytehq/airbyte/pull/7734) | Resolve $ref field for discover schema |
Expand Down

0 comments on commit aac54da

Please sign in to comment.