twitter4j

method retrieveRequestToken raises “Communication with the service provider failed: null”

和自甴很熟 提交于 2019-12-03 17:47:28
问题 I am using twitter4j to send tweet from my application. When I invoke the method retrieveRequestToken, I get the error "Communication with the service provider failed: null". public static void askOAuth(Context context) { try { // Use Apache HttpClient for HTTP messaging consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); provider = new CommonsHttpOAuthProvider( "https://api.twitter.com/oauth/request_token", "https://api.twitter.com/oauth/access_token", "https://api

Go back after call Intent.ACTION_VIEW in android

寵の児 提交于 2019-12-03 16:10:43
My app has 3 activity A, B, C. Activity A calls B. In B, I call Intent.ACTION_VIEW to do authentication with Twitter as below: public static void DoAuthen(Context context, String CallBackUrl) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException { httpOauthConsumer = new CommonsHttpOAuthConsumer(context.getString(R.string.Twitter_ConsumerKey), context .getString(R.string.Twitter_ConsumerSecret)); httpOauthprovider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token", "http://twitter.com/oauth/access_token",

Twitter Stream API to get users tweets

99封情书 提交于 2019-12-03 08:38:24
I am using twitter stream API to get tweets from user. I have list of user Id How would i get list of tweets from the TwitterStream API. I have analyzed the following sample public class TwitterStreamAPI { public static void main(String[] args) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey("xxxx"); cb.setOAuthConsumerSecret("xxx"); cb.setOAuthAccessToken("xxx"); cb.setOAuthAccessTokenSecret("xxx"); TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); UserStreamListener listener = new UserStreamListener() {

twitter4j - get tweets by ID

自作多情 提交于 2019-12-03 08:25:12
How can I get the tweets when I have the tweet ID and the user ID ? I have a file containing lines like : userID tweetID I guess I should go by : Query query = new Query("huh ?"); QueryResult result = twitter.search(query); List<Status> tweets = result.getTweets(); but I have no clue how to spell the query Thanks Well it was no search call. The tweet apparently is called Status and the code to retrieve one by ID is : final Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_KEY_SECRET); AccessToken accessToken = new AccessToken(TWITTER_TOKEN,

Twitter4j integration through Android Studio

我的梦境 提交于 2019-12-03 07:34:38
问题 I am trying to integrate Twitter4j library into Android project through Android Studio. Though there are enough materials for integration through Eclipse, there are no materials for integration through Android Studio. How to do the integration? 回答1: Just add compile 'org.twitter4j:twitter4j-core:4.0.2' to your /app/build.gradle dependencies. It should look like: repositories { mavenCentral() } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support

twitter4j - access tweet information from Streaming API

☆樱花仙子☆ 提交于 2019-12-03 06:06:10
问题 My goal is to collect all tweets containing the words "France" and "Germany" and to also collect associated metadata (e.g., the geo coordinates attached to the tweet). I know that this metadata is available, but I can't figure out how to access it with the Java library I'm using : "twitter4j". Ok, so what I have so far is taken from code samples on the twitter4j site. It prints out all tweets containing my chosen keywords, as they are provided in real-time by Twitter's Streaming API. I call

Twitter4j integration through Android Studio

*爱你&永不变心* 提交于 2019-12-02 22:31:47
I am trying to integrate Twitter4j library into Android project through Android Studio. Though there are enough materials for integration through Eclipse, there are no materials for integration through Android Studio. How to do the integration? Alexander Pavlov Just add compile 'org.twitter4j:twitter4j-core:4.0.2' to your /app/build.gradle dependencies. It should look like: repositories { mavenCentral() } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v4:19.+' compile 'org.twitter4j:twitter4j-core:4.0.2' } If you have downloaded the zip

Twitter 4j with Netbeans

随声附和 提交于 2019-12-02 21:51:21
问题 First time poster, but I'm really stuck. I'm working on a little project and I'm trying to send out a tweet using a netbeans project. I'm using twitter4j and it seems like things have recently changed to where you have to use their OAuth function. I've created an application on twitter and tried some code but I keep getting this error:Exception in thread "main" connect timed outRelevant discussions can be on the Internet at: http://www.google.co.jp/search?q=b2b52c28 or http://www.google.co.jp

adding language filter to twitter popularhashtags - scala

喜夏-厌秋 提交于 2019-12-02 09:41:00
I am new to Spark and Scala. I ran the Spark streaming job-twitter popular hash tags. I added a filter for some words and was able to filter out tweets : val filter = Array("spark", "Big Data") val stream = TwitterUtils.createStream(ssc, None, filter) Likewise I want to add a language filter so that only English tweets are streamed. Twitter4j has Track() and Locations . Does it have a language filter? If so, how does it work in Scala? I'm repeating what's already been said in this Spark thread . Spark uses Twitter4J for the feed. Twitter4J as of version 3.0.6 has getLang ( doc ) which allows

twitter4j geo streaming latitude/longitude for Hongkong

混江龙づ霸主 提交于 2019-12-02 08:20:10
I'm trying to capture tweets using twitter4j's streaming methods from the area of Hongkong. However not matter what latitude or longitude coordinates I choose to do so (from http://www.latlong.net/convert-address-to-lat-long.html ) I always get invalid latitude/longitude error. Latitude/longitude are not valid: 22.27, 114.17, 22.35, 114.21 The code I use is otherwise working fine: 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