Twitter API 推文流在主题标签 NodeJS 上过滤
Twitter API tweet stream filtered on hashtag NodeJS
我正在尝试从 Twitter API 获取包含特定主题标签的推文流
NodeJS.
我正在使用 this as a template for my purposes. According to this and this 我应该使用 header.
请求推文
This is what I tried 我知道这不是主题标签,但我也无法让它发挥作用。
您需要使用 Filtered Stream(而非 Sampled Stream)才能定位特定值或主题标签。检查 the Filtered Stream sample.
规则值指定您正在侦听的内容 - 这些被发送到单独的端点,并且未在 header 中指定。
对于示例代码,这是在此处设置的:
const rules = [
{ 'value': 'dog has:images -is:retweet', 'tag': 'dog pictures' },
{ 'value': 'cat has:images -grumpy', 'tag': 'cat pictures' },
];
这定义了两个规则,由两个单独的 标签 标识(这些可以帮助您确定结果通过时匹配的规则)。规则本身由 值 确定。这是您可以放置主题标签的地方。
我正在尝试从 Twitter API 获取包含特定主题标签的推文流 NodeJS.
我正在使用 this as a template for my purposes. According to this and this 我应该使用 header.
请求推文This is what I tried 我知道这不是主题标签,但我也无法让它发挥作用。
您需要使用 Filtered Stream(而非 Sampled Stream)才能定位特定值或主题标签。检查 the Filtered Stream sample.
规则值指定您正在侦听的内容 - 这些被发送到单独的端点,并且未在 header 中指定。
对于示例代码,这是在此处设置的:
const rules = [
{ 'value': 'dog has:images -is:retweet', 'tag': 'dog pictures' },
{ 'value': 'cat has:images -grumpy', 'tag': 'cat pictures' },
];
这定义了两个规则,由两个单独的 标签 标识(这些可以帮助您确定结果通过时匹配的规则)。规则本身由 值 确定。这是您可以放置主题标签的地方。