twitter4j

How to get a tweet with its full JSON in Twitter4j

狂风中的少年 提交于 2020-02-19 09:57:07
问题 I need to retrive a list of tweets, with many informations (easily retrievable from some Tweet.getX() methods) except for the tweet's entire JSON. I can't figure out how to get the JSON of a tweet belonging from a QueryResult. Anyone can help me? 回答1: You can get the JSON of your tweets by setting setJSONStoreEnabled(true); on the ConfigurationBuilder object that you pass to your TwitterFactory constructor. Here's a full example: public static void main(String[] args) throws TwitterException

Get json user from json tweet

╄→гoц情女王★ 提交于 2020-02-01 04:29:25
问题 I have a tweet that I had stored in a file. I want to extract the user as a json object and store it in a different file. The following results in java.lang.IllegalStateException: Apparently jsonStoreEnabled is not set to true. String jsonStatus; //Content read from a file Status status = TwitterObjectFactory.createStatus(jsonStatus); //no problem here String jsonUser = TwitterObjectFactory.getRawJSON(status.getUser()); //Exception How can I set jsonStoreEnabled to true ? Or, is there another

Get json user from json tweet

百般思念 提交于 2020-02-01 04:29:02
问题 I have a tweet that I had stored in a file. I want to extract the user as a json object and store it in a different file. The following results in java.lang.IllegalStateException: Apparently jsonStoreEnabled is not set to true. String jsonStatus; //Content read from a file Status status = TwitterObjectFactory.createStatus(jsonStatus); //no problem here String jsonUser = TwitterObjectFactory.getRawJSON(status.getUser()); //Exception How can I set jsonStoreEnabled to true ? Or, is there another

Can't get location filters to work using Twitter4J

戏子无情 提交于 2020-01-25 20:53:45
问题 My twitter4j streaming works when I am using track and user queries but when I use location queries, It returns a 404, i.e. $ java -cp .:twitter4j-core-4.0.4.jar:twitter4j-media-support-4.0.4.jar:twitter4j-async-4.0.4.jar:twitter4j-examples-4.0.4.jar:twitter4j-stream-4.0.4.jar PrintFilterLocationStream "{1,2}" [Wed Jul 06 00:05:41 SGT 2016]serialVersionUID: 6175546394599249696 [Wed Jul 06 00:05:41 SGT 2016]debug: true [Wed Jul 06 00:05:41 SGT 2016]user: null [Wed Jul 06 00:05:41 SGT 2016

Exception in thread “main” org.apache.spark.SparkException: org.apache.spark.SparkException: Couldn't find leaders for Set()-Spark Steaming-kafka

非 Y 不嫁゛ 提交于 2020-01-25 05:33:25
问题 I am working on a data pipeline which takes tweets from Twitter4j -> publishes those tweets to a topic in Kafka -> Spark Streaming subscribes those tweets for processing. But when I run the code I am getting the exception - Exception in thread "main" org.apache.spark.SparkException: org.apache.spark.SparkException: Couldn't find leaders for Set([LiveTweets,0]) The code is - import java.util.HashMap import java.util.Properties import twitter4j._ import twitter4j.FilterQuery; import twitter4j

Search twitter by language

余生长醉 提交于 2020-01-24 14:12:05
问题 In twitter by using lang operator you can search for retrieving tweets from a particular language: For example, the following search will return tweets only in english: https://twitter.com/search?q=lang:en Is there a way to achieve this using twitter api, especially using twitter4j. I know there is a language attribute for search but it also requires at least one keyword to make a search, I would like to search by a particular language without giving any keyword query. The following command

signout using Twitter4J is not working with android

℡╲_俬逩灬. 提交于 2020-01-16 18:56:12
问题 I am using twitter 4j 3.0.2 jar I have integrate twitter in my android app.I have successfully login and send tweet to twitter account but I face issue in logout from twitter account from my android app. I implement this as same as twitter4j sample app and I have noticed that same issue also in twitter4j sample app. Steps I have done When first time I click on login button from my app then login page of twitter opened. 2.I save token in SharedPreferences. 3.Convert login button to logout. 4

Processing twitter4j query with only Geolocation

ⅰ亾dé卋堺 提交于 2020-01-16 04:28:05
问题 Ok. Each time we get only 100 tweets. I want to show them on a map based on the Geolocation. Is there any way I can get 100 tweets that all of them have Geolocation. Because now only 3-4 out of 100 has Geolocation. I read some examples with FilterQuery but Processing throws me an error on it, as unknown. 回答1: Here is an working example. This was tested using twitter4j 4.0.2 The interface StatusListener is where you can do whatever you want with your tweets Kind of... is there that they arrive

twitter4j geo streaming latitude/longitude for Hongkong

做~自己de王妃 提交于 2020-01-11 13:41:47
问题 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

How to run Processing+Twitter4j sketch in broswer

北慕城南 提交于 2020-01-11 11:17:48
问题 I'm a newbie programmer practicing Processing and I recently developed a sketch that uses Twitter4j. When I run the sketch in Java mode from the Processing Development Environment it works perfectly. Also, when I export the sketch from Java mode the resulting application runs perfectly. However, when I switch to JavaScript mode and try to run the sketch the browser preview does not display anything. I believe the problem is related to Twitter4j because when I remove the Twitter4j-related code