Java examples for Social Media:Twitter
Find similar place on twitter
import twitter4j.GeoLocation; import twitter4j.Place; import twitter4j.SimilarPlaces; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; public final class FindSimilarPlaces { public static void main(String[] args) { if (args.length < 3) { System.exit(-1);//from ww w. j a v a 2 s. com } try { Twitter twitter = new TwitterFactory().getInstance(); GeoLocation location = new GeoLocation( Double.parseDouble(args[0]), Double.parseDouble(args[1])); String name = args[2]; SimilarPlaces places = twitter.getSimilarPlaces(location, name, null, null); System.out.println("token: " + places.getToken()); if (places.size() == 0) { System.out.println("nothing"); } else { for (Place place : places) { System.out.println("id: " + place.getId() + " " + place.getFullName()); } } System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.exit(-1); } } }