简体   繁体   English

使用多个帐户发送多个推文(提及)Twitter4j

[英]Send multiple tweets(mentions) with multiple accounts Twitter4j

I am designing an application using which the users would be able to send multiple tweets(mentions) from multiple accounts and am using Twitter4j for the same. 我正在设计一个应用程序,用户可以使用该应用程序从多个帐户发送多个推文(提及),并且将Twitter4j用于同一应用程序。 Regarding this, I have a few questions: 对此,我有几个问题:

  1. Authentication : The application has an authentication part.I am able to authenticate using the PIN based authentication(oob).But I want to know if it is possible to persist the access token such that the user only needs to authenticate once at the time of installing the app and never thereafter. 身份验证 :该应用程序具有身份验证部分。我能够使用基于PIN的身份验证(oob)进行身份验证。但是我想知道是否可以持久保存访问令牌,以便用户仅在进行身份验证时进行一次身份验证安装应用程序,此后再也没有。
  2. Exception Handling : The application would be sending multiple tweets.So I wish to know that what would be the way to check for exceptions, particularly the suspension of user account. 异常处理 :该应用程序将发送多条推文。因此,我想知道检查异常的方法是什么,特别是用户帐户的暂停。
  3. Limit : What would be a safe rate(I mean minimum interval between two tweets) to send the tweets hourly or per minute. 限制 :每小时或每分钟发送一次推文的安全速率(我的意思是两次推文之间的最小间隔)。 Does twitter also check for the IP of the machine for suspending the accounts? twitter还会检查用于暂停帐户的机器的IP吗? I mean suppose I need to send 60 tweets.If I am using 4 accounts to do the same with 15 tweets per account and run 4 threads for the same, will that allow me to send more tweets form my app? 我的意思是假设我需要发送60条推文,如果我使用4个帐户执行相同的操作,每个帐户有15条推文并运行4个线程,那么我是否可以通过我的应用发送更多推文?

EDIT Kindly note that I am making a desktop app, not a web app.So a PIN based authentication is necessary. 编辑请注意,我正在制作桌面应用程序,而不是Web应用程序。因此,需要基于PIN的身份验证。 Also I am not sure about the validity lifetime of an access token.Will the access token once generated by using OOB authentication be valid forever so that I can save it in a database and hence enable user to authenticate only once? 我也不确定访问令牌的有效期,使用OOB身份验证生成的访问令牌是否将永远有效,以便我可以将其保存在数据库中并因此仅允许用户进行一次身份验证?

Some points to note: 需要注意的几点:

  • Authentication : It is possible to get the access token without using pin based authentication, for that when you create an application you have to specify a callback url, and so you dont have to copy and paste the pin, instead a parameter oauth_verifier is appended with the callback url which you can fetch from the url itself. 身份验证 :无需使用基于引脚的身份验证就可以获取访问令牌,因为在创建应用程序时,您必须指定一个回调URL,这样就不必复制和粘贴该引脚,而是在参数oauth_verifier添加了oauth_verifier您可以从网址本身获取的回调网址。 With this oauth_verifier , you can get a ccess_token and token_secret as mentioned here 有了这个oauth_verifier ,你可以得到一个ccess_tokentoken_secret提到这里
  • Exception Handling : Nothing other than simple try catch can be more helpful here. 异常处理 :除了简单的try catch以外,这里别无其他方法。
  • Limit : There are two initial buckets available for GET requests: 15 calls every 15 minutes, and 180 calls every 15 minutes. 限制 :初始两个存储段可用于GET请求:每15分钟15个调用,每15分钟180个调用。 Refer here for more details. 有关更多详细信息,请参见此处

Edit: For desktop app there is no other alternative, so you have to do a pin based authentication and since twitter works on Oauth1, so as of now, the validity of the access_token and token_secret is lifetime. 编辑:对于桌面应用程序,没有其他选择,因此您必须进行基于引脚的身份验证,并且由于twitter在Oauth1上有效,因此,到目前为止, access_tokentoken_secret的有效性是有效期。 So authentication is required only once and the api calls can be made using same tokens. 因此,仅需要一次身份验证,并且可以使用相同的令牌进行api调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM