跟踪多个主题标签

跟踪多个主题标签

本文介绍了使用 Twitter 流 API 跟踪多个主题标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我访问时(使用适当的凭据):

When I access (w/ proper credentials):

https://stream.twitter.com/1/statuses/filter.json?lang=en&track=#help'

我得到了我想要的:带有#help 标签的无休止的推文流.

I get what I want: an unending stream of tweets with the #help hashtag.

然而,

https://stream.twitter.com/1/statuses/filter.json?lang=en&track=#help,#perl

产生错误

片段中索引 70 处的非法字符:https://stream.twitter.com/1/statuses/filter.json?lang=en&track=#help,#perl

Illegal character in fragment at index 70:https://stream.twitter.com/1/statuses/filter.json?lang=en&track=#help,#perl

这似乎是#perl"中的#".怎么修?

which appears to be the '#' in '#perl'. How to fix?

作为参考,这很好用:

https://stream.twitter.com/1/statuses/filter.json?lang=en&track=perl,#help

虽然没有:

https://stream.twitter.com/1/statuses/filter.json?lang=en&track=perl,#help,#ruby

是否有规则不跟踪多个主题标签,或者我在做什么更根本的错误?我是否应该只跟踪#hashtag"跟踪标签"?

Is there a rule re not tracking more than one hashtag, or am I doingsomething more fundamentally wrong? Should I track '#hashtag' by justtracking 'hashtag'?

推荐答案

['term1,term2']

但是主题标签呢?此链接说不要使用它们:https://dev.twitter.com/流媒体/概述/请求参数#track

But what about the hashtags? This link says not to use them: https://dev.twitter.com/streaming/overview/request-parameters#track

我们可以用

upgrades_str = re.sub('[\' \[\]]', '', upgrades_str)
upgrades_str = '[\''+format(upgrades_str)+'\']'

这篇关于使用 Twitter 流 API 跟踪多个主题标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 17:22