Twitter API 是否允许按用户名和主题标签进行过滤?
我可以获得特定用户使用特定主题标签的所有推文吗?
我可以只获取过去 100 条推文,然后在我这边进行过滤,但如果 Twitter 可以在他们这边进行过滤,那就方便多了。
这可能吗?
Can I get all the tweets of a particular user, in which a particular hashtag is used?
I could just get the past 100 tweets then filter them on my end, but it would be much more convenient if Twitter could do the filtering on their end.
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Twitter 的高级搜索可让您构建所需的查询。不幸的是,目前搜索结果似乎只针对过去 24 小时左右发布的推文;可能只是暂时的限制,不确定。
无论如何,您的请求 URL 可能如下所示(请注意 JSON 和 Atom 类型):
http://search.twitter.com/search?q=%23HASHTAG+from:USERNAME
http://search.twitter.com/search.json?q=%23HASHTAG+from:USERNAME
http://search.twitter.com/search.atom?q=%23HASHTAG+from:USERNAME
但由于当前的时间范围限制,它不太实用。
Twitter's Advanced Search lets you construct the query you desire. Unfortunately, search results only seem to be for tweets posted within the past 24 hours or so right now; might just be a temporary limitation, not sure.
In any case, your request URL might look something like this (note the JSON and Atom types):
http://search.twitter.com/search?q=%23HASHTAG+from:USERNAME
http://search.twitter.com/search.json?q=%23HASHTAG+from:USERNAME
http://search.twitter.com/search.atom?q=%23HASHTAG+from:USERNAME
But with the current timeframe limitation, it's not very practical.
我正在阅读 Twitter 文档,他们说现在它只包含 6-9 天的推文。链接 https://dev.twitter.com/docs/using-search
I am reading the twitter documentation and they say right now it will include only 6-9 days of tweets. Link https://dev.twitter.com/docs/using-search
要针对 Twitter API v1.1(需要 OAuth)进行此搜索,您需要向结构如下的 URL 发出 GET 请求:
请参阅他们的 Search API 的“如何构建查询”部分。不过,您在过去 7 天内只能发布推文。
To do this search against v1.1 of Twitter's API (which requires OAuth), you'd issue a GET request to the a URL structured like:
See their Search API's "How to build a query" section. You'll be constrained to tweets over the last 7 days, though.