javascript - 按标签搜索 Twitter Api
问题描述
我到底如何使用 Twitter API?网上的一切似乎都过时了,而且不起作用。我在开发者门户上创建了一个 twitter 应用程序并获得了我的访问令牌等。我现在该怎么办?我正在尝试使用 JQuery 发出 ajax 获取请求。但是我该怎么做?他们的文档完全是垃圾。
解决方案
请参考文档
它建议您可以使用网址的地方
https://api.twitter.com/1.1/search/tweets.json?q=%23superbowl&result_type=recent
获取带有superbowl
主题标签的最新推文。
请注意,#
该网址中的 已编码为%23
. 您可以在此处找到这些编码的参考。
从文档中,您可以执行以下不同的搜索操作:
Operator Finds Tweets...
watching now containing both “watching” and “now”. This is the default operator.
“happy hour” containing the exact phrase “happy hour”.
love OR hate containing either “love” or “hate” (or both).
beer -root containing “beer” but not “root”.
#haiku containing the hashtag “haiku”.
from:interior sent from Twitter account “interior”.
list:NASA/astronauts-in-space-now sent from a Twitter account in the NASA list astronauts-in-space-now
to:NASA a Tweet authored in reply to Twitter account “NASA”.
@NASA mentioning Twitter account “NASA”.
politics filter:safe containing “politics” with Tweets marked as potentially sensitive removed.
puppy filter:media containing “puppy” and an image or video.
puppy -filter:retweets containing “puppy”, filtering out retweets
puppy filter:native_video containing “puppy” and an uploaded video, Amplify video, Periscope, or Vine.
puppy filter:periscope containing “puppy” and a Periscope video URL.
puppy filter:vine containing “puppy” and a Vine.
puppy filter:images containing “puppy” and links identified as photos, including third parties such as Instagram.
puppy filter:twimg containing “puppy” and a pic.twitter.com link representing one or more photos.
hilarious filter:links containing “hilarious” and linking to URL.
puppy url:amazon containing “puppy” and a URL with the word “amazon” anywhere within it.
superhero since:2015-12-21 containing “superhero” and sent since date “2015-12-21” (year-month-day).
puppy until:2015-12-21 containing “puppy” and sent before the date “2015-12-21”.
movie -scary :) containing “movie”, but not “scary”, and with a positive attitude.
flight :( containing “flight” and with a negative attitude.
traffic ? containing “traffic” and asking a question.
推荐阅读
- bootstrap-4 - 如何在 rails 6(github/rails HEAD 上的 Rails 6.0.0.beta3)应用程序上安装 bootstrap 4?
- azure-devops - CD 管道中的任务以在每次部署之前编辑或转换某些文件
- php - 如何从 PHP 中的 DateTimeInterface 创建 DateTime?
- java - 在新窗口中弹出警报
- ios - 按钮和锚标签悬停和活动在 Iphone 的 Chrome 上不起作用
- html - SVG 圆圈上的文字
- json - 当我尝试以角度 2 显示 json(数组到对象中)时出现问题
- javascript - Javascript:将数据从数组导出到 HTML 表
- javascript - JavaScript:在模板变量中添加 if 条件
- java - 长时间空闲时,Client Socket程序是否有可能断开连接但没有收到任何事件?