ConsumeTwitter 2025.5.31.15

捆绑包

org.apache.nifi | nifi-social-media-nar

描述

Streams 通过 Twitter 的流式传输 API v2 进行推文。该流根据先前上传的规则提供示例流或搜索流。该处理器还为推文的某些字段提供传递功能,以便这些字段作为响应的一部分返回。有关推文对象模型的更多信息,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/introduction (link removed)。

标签

json、social media、status、tweets、twitter

输入要求

FORBIDDEN

支持敏感的动态属性

false

属性

属性

描述

backfill-minutes

断开连接后请求的流式传输数据的分钟数(最多 5 分钟)。仅适用于具有学术研究访问权限的项目。请参阅 https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/integrate/recovery-and-redundancy-features (link removed)

backoff-attempts

在抛出异常之前,如果流因任何原因断开连接,处理器将尝试重新连接的次数。要在出现此异常且连接修复后启动流,请停止处理器并重新启动。如果此属性的值为 0,则永远不会发生退避,如果流失败,则始终需要重新启动处理器。

backoff-time

如果当前流因任何原因失败,则在请求新流之前退避的持续时间。每次重新启动失败时都会增加 2 倍

base-path

处理器用于发出 HTTP 请求的基本路径。对于大多数用例,默认值应该足够了。

batch-size

写入单个 FlowFile 的推文的数量上限。将根据处理器调用时队列中的可用数量减少写入的推文。

bearer-token

Twitter 提供的持有者令牌。

connect-timeout

客户端与 Twitter API 建立连接的超时时间上限。将该值设置为 0 会禁用连接超时。

expansions

返回推文中以逗号分隔的对象扩展列表。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/expansions (link removed)。可能的字段值包括:author_id、referenced_tweets.id、referenced_tweets.id.author_id、entities.mentions.username、attachments.poll_ids、attachments.media_keys、in_reply_to_user_id、geo.place_id

maximum-backoff-time

开始尝试新流的最大退避持续时间。建议此数字远远高于“Backoff Time”属性

media-fields

以逗号分隔的媒体字段列表,将作为推文的一部分返回。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media (link removed)。可能的字段值包括:alt_text、duration_ms、height、media_key、non_public_metrics、organic_metrics、preview_image_url、promoted_metrics、public_metrics、type、url、width

place-fields

以逗号分隔的位置字段列表,将在推文中返回。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/place (link removed)。可能的字段值包括:contained_within、country、country_code、full_name、geo、id、name、place_type

poll-fields

以逗号分隔的轮询字段列表,将作为推文的一部分返回。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/poll (link removed)。可能的字段值包括:duration_minutes、end_datetime、id、options、voting_status

queue-size

流式消息的内部队列的大小上限

read-timeout

在超时之前,通过 API 接收来自 Twitter 的推文的最长不活动时间。将该值设置为 0 会禁用读取超时。

stream-endpoint

处理器所用推文的来源。

tweet-fields

以逗号分隔的推文字段列表,将作为推文的一部分返回。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/tweet (link removed)。可能的字段值包括:attachments、author_id、context_annotations、conversation_id、created_at、entities、geo、id、in_reply_to_user_id、lang、non_public_metrics、organic_metrics、possibly_sensitive、promoted_metrics、public_metrics、referenced_tweets、reply_settings、source、text、withheld

user-fields

以逗号分隔的用户字段列表,将作为推文的一部分返回。有关正确用法,请参阅 https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user (link removed)。可能的字段值包括:created_at、description、entities、id、location、name、pinned_tweet_id、profile_image_url、protected、public_metrics、url、username、verified、withheld

关系

名称

描述

success

FlowFiles 包含由一条或多条推文组成的数组

写入属性

名称

描述

mime.type

MIME 类型设置为 application/json

tweets

FlowFile 中的推文数量

语言: 中文