twitter: adding promoted_metrics to the API call

Signed-off-by: Alexis Pentori <alexis@status.im>
This commit is contained in:
Alexis Pentori 2024-04-16 15:55:57 +02:00
parent 11efa92811
commit 36555d0c23
No known key found for this signature in database
GPG Key ID: 65250D2801E47A10
3 changed files with 50 additions and 27 deletions

View File

@ -10,7 +10,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 1c448bfb-8950-478c-9ae0-f03aaaf4e920
dockerImageTag: '0.2.0'
dockerImageTag: '0.2.1'
dockerRepository: status-im/airbyte/source-twitter-fetcher
githubIssueLabel: source-twitter-fetcher
icon: twitter-fetcher.svg

View File

@ -3,57 +3,57 @@
"type": "object",
"properties": {
"id": {
"type": [ "null", "string"]
"type": ["null", "string"]
},
"text": {
"type": [ "null", "string"]
"type": ["null", "string"]
},
"created_at": {
"type": [ "null", "string"]
"type": ["null", "string"]
},
"author_id": {
"type": [ "null", "string"]
"type": ["null", "string"]
},
"conversation_id": {
"type": [ "null", "string"]
"type": ["null", "string"]
},
"reply_settings": {
"type": ["null", "string"]
"type": ["null", "string"]
},
"referenced_tweets": {
"type": [ "null", "array" ],
"type": ["null", "array"],
"items": {
"type": ["object"],
"properties":{
"type": {
"type": [ "null", "string" ]
"type": ["null", "string"]
},
"id": {
"type": [ "null", "number" ]
"type": ["null", "number"]
}
}
}
},
"public_metrics": {
"type": ["null", "object" ],
"type": ["null", "object"],
"properties": {
"retweet_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"reply_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"like_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"quote_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"impression_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"bookmark_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
}
}
},
@ -61,13 +61,36 @@
"type": ["null", "object" ],
"properties": {
"impression_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"url_link_clicks": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"user_profile_clicks": {
"type": [ "null", "number" ]
"type": ["null", "number"]
}
}
},
"non_public_metrics": {
"type": ["null", "object" ],
"properties": {
"impression_count": {
"type": ["null", "number"]
},
"like_count": {
"type": ["null", "number"]
},
"reply_count": {
"type": ["null", "number"]
},
"retweet_count": {
"type": ["null", "number"]
},
"url_link_clicks": {
"type": ["null", "number"]
},
"user_profile_clicks": {
"type": ["null", "number"]
}
}
},
@ -75,22 +98,22 @@
"type": ["null", "object" ],
"properties": {
"impression_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"url_link_clicks": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"user_profile_clicks": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"retweet_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"reply_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
},
"like_count": {
"type": [ "null", "number" ]
"type": ["null", "number"]
}
}
}

View File

@ -71,7 +71,7 @@ class Tweet(HttpSubStream, Account):
) -> str:
account_id = stream_slice.get("parent").get("id")
logger.info("Account id %s", account_id)
return f"users/{account_id}/tweets?tweet.fields=text,public_metrics,non_public_metrics,organic_metrics,author_id,referenced_tweets,created_at"
return f"users/{account_id}/tweets?tweet.fields=text,public_metrics,non_public_metrics,organic_metrics,author_id,referenced_tweets,promoted_metrics,created_at"
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
logger.debug("Twtter Response: %s", response.json())