我正在使用以下代码从特定位置获取趋势。是否可以检查某个特定主题或主题标签是否在Twitter上趋势?
try {
// Twitter twitter = new TwitterFactory().getInstance();
ResponseList<Location> locations;
locations = twitter.getAvailableTrends();
System.out.println("Showing available trends");
for (Location location : locations) {
System.out.println(location.getName() + " (woeid:" + location.getWoeid() + ")");
}
System.out.println("done.");
Trends trends = twitter.getPlaceTrends(2211096);
for (int i = 0; i < trends.getTrends().length; i++) {
System.out.println(trends.getTrends()[i].getName() + trends.getTrends()[i].getURL());
}
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get trends: " + te.getMessage());
System.exit(-1);
}
答案 0 :(得分:0)
否 - API允许您检查当前趋势,但除了提供您正在检查的位置之外,您无法将自己的查询添加到API调用。您必须浏览该位置的API响应,以检查所选术语是否趋势。