dongzh1988 2013-06-10 13:52
浏览 46
已采纳

使用Oauth通过应用程序凭据从Twitter获取趋势,没有特定的Twitter用户

I'm sorry if this has been asked before but it seems almost all answers on SO are relating to the Twitter API 1.0 and not the newer 1.1 using REST and OAuth.

I need to be able to access the latest twitter trends for specific countries, and for global, so I know our URL (for global in this case) will be:

https://api.twitter.com/1.1/trends/place.json?id=1&exclude=hashtags

... and replacing "1" with location ID's based on Yahoo's WOEID. Pretty straightforward.

Where I'm getting lost is, we want to do this at an application level at a regular interval, for instance get the current trends for Canada every N hours. There wont be a user logged in as this would be a maintenance script called via CRON, so the whole "redirect" process is throwing me off.

How can my application get these trends without requiring specific user authorization to get a "token"?

Or is there a way to create a serialized token from our registered application in twitters API area.... or is this even possible, are we breaking some sort of Terms of Use provision in attempting this?

  • 写回答

1条回答 默认 最新

  • doujiang2812 2013-06-10 15:38
    关注

    Finally came upon what I was looking for, the "Application Only" access is done in quite a different way, I just wasn't searching for the right terms to get what I was looking for, here's the page describing all the steps necessary to get a "Bearer" token which can be used to poll Twitter without any traditional user credentials...

    https://dev.twitter.com/docs/auth/application-only-auth
    

    Hope that helps someone else find it faster.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能