Questions tagged [twitter4j]

Twitter4J is a library enabling calls to the Twitter API from Java. With Twitter4J, you can easily integrate your Java application with the Twitter service. Twitter4J is an unofficial library.

With Twitter4J, you can easily integrate your Java application with the Twitter service.

Features

  • 100% Pure Java - works on any Java Platform version 5 or later
  • Android platform and Google App Engine ready
  • Zero dependency: No additional jars required
  • Built-in OAuth support
  • Out-of-the-box gzip support
  • 100% Twitter API 1.1 compatible
1563 questions
5
votes
1 answer

Closing Browser window after twitter login android with twitter4J

Hi I am developing android application in which I am using twitter login. I am using twitter4j-3.0.5 lib for twitter authentication. So my scene is like this after login successful it come back to my application but in background it is not closing…
nilkash
  • 7,408
  • 32
  • 99
  • 176
5
votes
1 answer

getting most popular hashtags using twitter api

I want to retrieve top 10 or top 20 most popular hashtags from twitter api. How can I do it, is there any direct api for this or should I collect a large dataset using twitter search api and manually collect popular hashtags?
Mr_Hmp
  • 2,474
  • 2
  • 35
  • 53
5
votes
2 answers

Twitter4j - Rate limit exceeded

I would like to get followers using getFollowersIds() in Twitter4j, but I get ConnectionErrorException ... rate limit exceeded public static void main(String[] args) { try { Twitter twitter = TwitterFactory.getSingleton(); …
Matt
  • 8,195
  • 31
  • 115
  • 225
5
votes
2 answers

Twitter Stream API to get users tweets

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[]…
jackyesind
  • 3,343
  • 14
  • 47
  • 74
5
votes
3 answers

stop the Twitter stream and return List of status with twitter4j

Using the code example provided by Twitter4j, I'd like t stop the stream after a list of 1,000 status have been collected, and return this list. How can I do that? public class Stream { public List execute throws TwitterException { …
seinecle
  • 10,118
  • 14
  • 61
  • 120
5
votes
1 answer

Stream Closed error in twitter4j how to solve

it says Stream Closed error public class StreamAPI { public static void main(String[] args) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true); cb.setOAuthConsumerKey("xxxx"); …
jackyesind
  • 3,343
  • 14
  • 47
  • 74
5
votes
1 answer

Twitter4j getFollowersIDs cursor issue

I'm new to this Twitter4j library. I am trying to store all the followers ID's of a user with given userID. I am using something like the following: IDs ids; long cursor = -1; do{ ids = twitter.getFollowersIDs(userName, cursor); for (long…
Sait
  • 19,045
  • 18
  • 72
  • 99
5
votes
3 answers

How to search for tweets using twitter API 1.1 and java

Twitter API has been changed from 1.0 to 1.1. Now for any type of query it has to be authorized. I am using java for fetching tweets. Can anyone give me some java example of tweet fetching using OAuth authentication. Update Using twitter4j api it is…
MAK Ripon
  • 1,065
  • 4
  • 14
  • 27
5
votes
1 answer

Twitter4j: getting inconcistent authentication errors when invoking getFollowersIDs

I am using Twitter4j version 3.0.3. I am trying to pull follower id and using OAuth. I have been using Twitter4j for years and am relatively experienced with the framework. However something strange is happening: My program will run fine and then…
user1172468
  • 5,306
  • 6
  • 35
  • 62
5
votes
1 answer

Twitter4J verify Credentials and catching error

I have the following code on google appengine to test if twitter credentials are valid using twitter4j public void doGet(HttpServletRequest req, HttpServletResponse resp) { String Test = "Testing Twitter4J"; try { …
Michael
  • 1,321
  • 1
  • 13
  • 27
5
votes
2 answers

Using Android AccountManager Twitter credentials to create Twitter4J AccessToken

I am getting Twitter credentials from the Android AccountManager using the following code: AccountManager am = AccountManager.get(this); Account account =…
5
votes
4 answers

Using Twitter4j library for Android

I'm trying to create a twitter client with twitter4j library. But still I'm not clear with the stuff and I couldn't find a good tutorial. Most of the tutorials are outdated. Mainly I want to know that, do I have to use OAuth everytime when I'm…
kinath_ru
  • 4,488
  • 3
  • 21
  • 26
5
votes
3 answers

twitter4j - get tweets by ID

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 tweets =…
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
5
votes
2 answers

No authentication challenges foundRelevant discussions can be found on the Internet at

I have some typical codes which used Twitter4J to connect Twitter API. They worked fine in android 1.x and 2.x. 3.x 4.x But failed in Android 4.1.1 and 4.1.2 with Nexus 7 device! Source: private void retrieveRequestToken() { …
5
votes
2 answers

Twitter4J Access token already available

I am receiving error messages while working with Twitter4J: java.lang.IllegalStateException: Access token already…
Martin Bories
  • 1,067
  • 17
  • 37