Cron 自动化 Twitter API 访问 [英] Cron automated Twitter API access

查看:32
本文介绍了Cron 自动化 Twitter API 访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个应用程序来帮助我们的营销团队管理 Twitter 竞赛.我一直在使用 Twitter 搜索 API,我认为它可以正常工作,但事实证明我错过了一些推文,由于 Twitter 搜索的限制.

I am trying to build an application to help our marketing team manage a twitter competition. I had been using the Twitter search API, and I had assumed that it was working but it turns out that I am missing some tweets, due to limitations in the Twitter Search.

我现在转而尝试使用 OAuth 进入 API 并提取我们的 twitter 用户推文,以便我们不会错过任何推文.

I have now switched over to trying to use OAuth to get into the API and pull our twitter users tweets so that we don't miss any.

我需要将推文保存到数据库中,因此想在 cron 上运行它.每次运行 cron 时,我都无法单击使用 Twitter 进行身份验证"链接.那么我该如何解决这个问题呢?我只需要对我们自己的帐户进行读取访问.我并没有真正创建这样的应用程序,只需要阅读我们帐户中的所有竞赛推文.

I need to save the tweets into the database, thus wanting to run it on a cron. I can't click and 'Auth with Twitter' link every time the cron runs. So how do I solve this problem? I only require read access to our own account. I'm not really creating an application as such, just need to read all the competition tweets from our account.

我一直在使用 TwitterOAuth 类,来自 twitter 文档,但我在解决这个先入为主的想法时遇到了巨大的麻烦,即我正在构建一个应用程序来发布到 twitter,当这个用例不适合时,人们需要对其进行身份验证我需要.

I have been using TwitterOAuth class, from the twitter docs, but am having immense trouble getting around the preconceived idea that I'm building an app to post to twitter which people need to auth when this use case doesn't fit what I need.

推荐答案

当您的应用程序使用 OAuth 对用户帐户进行身份验证时,它应该返回一个访问令牌,其中包含一个令牌和令牌机密.让您的应用程序保存这些详细信息;他们不会改变.然后,对于未来对 API 的请求,请在您的请求中发送这些详细信息,您无需在 Twitter 网站上重新进行身份验证.

When your application authenticates a user account using OAuth, it should get back an access token, containing a token and token secret. Have your application save these details; they won't change. Then for future requests to the API, send along these details in your requests and you shouldn't need to re-auth on the Twitter site.

或者,您可能会看到询问 Twitter 团队您的应用程序是否可以使用 xAuth,使您无需在 Twitter 网站上单击以进行身份​​验证",尽管这通常是为桌面应用程序保留的;不太确定它是否适合您的应用.

Alternatively, you might see about asking the Twitter team if your application can use xAuth, saving you from having to even need to "click to authenticate" on the Twitter site, though this is generally reserved for desktop applications; not too sure if it would be appropriate for your app.

这篇关于Cron 自动化 Twitter API 访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆