Tag: twitter4j

twitter4j geo流媒体纬度/经度为香港

我正试图使用​​来自香港地区的twitter4j流媒体方法来捕捉推文。 然而,不管我选择这样做的纬度或经度坐标(来自http://www.latlong.net/convert-address-to-lat-long.html ),我总是得到无效的纬度/经度误差。 Latitude/longitude are not valid: 22.27, 114.17, 22.35, 114.21 我使用的代码是正常工作: TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); FilterQuery fq = new FilterQuery(); fq.locations( new double[][]{ new double[]{ 22.274286d, 114.166875d}, new double[]{22.351943d, 114.214683d} }); twitterStream.addListener(listener); twitterStream.filter(fq); 我错过了什么? 纬度/经度是否有任何限制? 我已经注意让西南点在arrays中排在第一位。

回复使用Twitter4J推文您的帐户的用户

我正在使用Twitter4J自动发送推文。 基本上我想做的是: 如果用户推特我的帐户,我会回答“你好你好!” 例如。 我知道如何使用Twitter4J进行推文,但只是不知道如何回复发推特给我的用户。 这是我正常推文的方式: // The factory instance is re-useable and thread safe. Twitter twitter1 = TwitterFactory.getSingleton(); Status status = twitter1.updateStatus(“Hello Hello”); System.out.println(“Successfully updated the status to [” + status.getText() + “].”); 我想我需要这样做:1。请求最后一条推文2.如果newTweet.id!= oldTweet.id则表示你有新消息,否则跳转到第4步3.回复4.循环1

twitter中的流API没有响应

我正在使用twitter4j Stream API 3.0.3 jar 。 我尝试获取用户流和推文我的代码如下。 它只运行过去1小时内没有显示任何输出。 public class StreamAPI { public static void main(String[] args) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey(“xxxx”); cb.setOAuthConsumerSecret(“xxxx”); cb.setOAuthAccessToken(“xxx-x”); cb.setOAuthAccessTokenSecret(“xxxxx”); cb.setUseSSL(true); TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); RawStreamListener listener = new RawStreamListener() { @Override public void onMessage(String rawJSON) { System.out.println(rawJSON); } @Override public void onException(Exception ex) { ex.printStackTrace(); […]

twitter4j没有发现身份validation挑战

一直试图使用twitter4j发布推文几天没有运气,我想做的是让一个人在一轮结束时从应用程序在他们的时间轴上发布新的最高分。 这是我的代码 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tweetr); Button tweetr = (Button)findViewById(R.id.tweetr); //create a new twitter configuration using user details tweetTwitter = new TwitterFactory().getInstance(); tweetTwitter.setOAuthConsumer(TWIT_KEY, TWIT_SECRET); //create a twitter instance // tweetTwitter = new TwitterFactory(twitConf).getInstance(); tweetr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dt.execute(); } }); } public class TweetTask extends AsyncTask […]

Twitter认证后的CallBack

我正在尝试将twitter集成到我的应用程序中,但我似乎无法让它工作。 这是我的代码: public class OAuthForTwitter extends Activity { private CommonsHttpOAuthConsumer httpOauthConsumer; private OAuthProvider httpOauthprovider; public final static String consumerKey = “xxxxxxxxxxxxxx”; public final static String consumerSecret = “xxxxxxxxxxxx”; private final String CALLBACKURL = “sosInternational:///HierBenIkNu”; private Twitter twitter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); doOAuth(); } /** * Opens the browser using signpost jar […]

使用Twitter4J的朋友的好友列表

如何使用Twitter4J获取朋友或粉丝的好友列表? 使用getFriendsId() ,我只能检索经过身份validation的当前用户的朋友/关注者列表。 我想要的是获得经过身份validation的用户的关注者或朋友的朋友列表。

Twitter4j TwitterStream没有收到所有推文

我试图通过twitter4j TwitterStream对象获取Twitter上的所有推文。 我不确定我收到了所有的推文。 为了测试流API返回推文之前的延迟,我在twitter上发布了一条推文。 但即使很长一段时间后我也没有收到这条推文。 twitter4j是否会抓住Twitter上发布的每条推文,或者它的推文丢失率很高? 或者我在这里做错了什么? 这是我用来获取推文的代码: StatusListener listener = new StatusListener(){ int countTweets = 0; // Count to implement batch processing public void onStatus(Status status) { countTweets ++; StatusDto statusDto = new StatusDto(status); session.saveOrUpdate(statusDto); // Save 1 round of tweets to the database if (countTweets == BATCH_SIZE) { countTweets = 0; session.flush(); session.clear(); […]

REST API,关于403错误代码?

我们使用软件应用程序将推文发布到来自同一IP地址的多个帐户。 在twitter的回应中,我们得到403错误代码,我们使用的API是REST API。 是否对IP地址有任何限制,因为我们肯定没有跨越为REST API提到的API后限。 我们也不会超过140个字符。 等待回复.. 提前致谢..

得到“错误”:“使用Java驱动程序插入mongo时出现E11000重复键错误

线程“main”中的exceptioncom.mongodb.MongoException $ DuplicateKey:{“serverUsed”:“localhost / 127.0.0.1:27017”,“err”:“E11000重复键错误索引:twitterdb03.LevelAFollowers。$ id dup key:{ :ObjectId(’52d5636de408652b4853a8fe’)}“,”code“:11000,”n“:0,”connectionId“:12,”ok“:1.0} 我正在使用mongo 2.11.1 在java中从未遇到过简单的写操作问题 myMap.put(inid, followersList); myObj.putAll(myMap); myIdMapCollection.insert(myObj);

Twitter4j:获取某条推文的回复列表

是否有可能使用twitter4j获取回复推文(或回复)的推文列表? Twitter网站和Android应用程序具有此function。