twitter4j.Twitter.searchPlaces()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中twitter4j.Twitter.searchPlaces()方法的一些代码示例,展示了Twitter.searchPlaces()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Twitter.searchPlaces()方法的具体详情如下:
包路径:twitter4j.Twitter
类名称:Twitter
方法名:searchPlaces

Twitter.searchPlaces介绍

暂无

代码示例

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Place> places = twitter.searchPlaces(query);
    for (TwitterListener listener : listeners) {
      try {
        listener.searchedPlaces(places);
      } catch (Exception e) {
        logger.warn("Exception at searchPlaces", e);
      }
    }
  }
});

代码示例来源:origin: openimaj/openimaj

private String searchWithTwitter(String location) throws EnforcedWaitException {
  while(true){
    try {
      twitterLastCall.enforce();
      ResponseList<Place> res = this.twitter.searchPlaces(new GeoQuery(location));
      if(res.size() > 0)
        return res.get(0).getCountryCode();
      else
        return null;
    } catch (TwitterException e) {
      this.twitterLastCall.currentWait = Twitter4jUtil.handleTwitterException(e, TWITTER_DEFAULT_ERROR_BUT_NO_WAIT_TIME);
      throw new EnforcedWaitException(this.twitterLastCall);
    }
  }
}

代码示例来源:origin: org.openimaj.tools/TwitterPreprocessingTool

private String searchWithTwitter(String location) throws EnforcedWaitException {
  while(true){
    try {
      twitterLastCall.enforce();
      ResponseList<Place> res = this.twitter.searchPlaces(new GeoQuery(location));
      if(res.size() > 0)
        return res.get(0).getCountryCode();
      else
        return null;
    } catch (TwitterException e) {
      this.twitterLastCall.currentWait = Twitter4jUtil.handleTwitterException(e, TWITTER_DEFAULT_ERROR_BUT_NO_WAIT_TIME);
      throw new EnforcedWaitException(this.twitterLastCall);
    }
  }
}

代码示例来源:origin: org.mule.modules/mule-module-twitter

/**
 * Search for places that can be attached to a statuses/update. Given a latitude
 * and a longitude pair, or and IP address, this request will return a list of
 * all the valid places that can be used as the place_id when updating a status.
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:searchPlaces}
 *
 * @param latitude  latitude coordinate. Mandatory if ip is not specified
 * @param longitude longitude coordinate.
 * @param ip        the ip. Mandatory if coordinates are not specified
 * @return a {@link ResponseList} of {@link Place}
 * @throws TwitterException when Twitter service or network is unavailable
 */
@Processor
public ResponseList<Place> searchPlaces(@Placement(group = "Coordinates") @Optional Double latitude,
                    @Placement(group = "Coordinates") @Optional Double longitude,
                    @Optional String ip) throws TwitterException {
  return getConnectionManagement().getTwitterClient().searchPlaces(createQuery(latitude, longitude, ip));
}

相关文章