我想从公共网址中抓取另一个用户帖子,例如https://facebook.com/any_user_name 在春季社交脸书。 我尝试了多种方式,但无法获取数据,它总是返回未授权获取数据。
@Autowired
private Facebook facebook;
@Autowired
private ConnectionRepository connectionRepository;
if(connectionRepository.findPrimaryConnection(Facebook.class)!=null){
log.info("inside facebook connection repositlry to get primary connection");
facebook = connectionRepository.findPrimaryConnection(Facebook.class).getApi();
if(facebook.isAuthorized())
log.info("facebook is authorised");
}else
log.info("connection repository null for facebook");
- PagedList<Reference> pr =
facebook.userOperations().search("any_user_name");
- PagedList<Post> posts =
facebook.feedOperations().getFeed("any_user_name");
- String htmlData =
facebook.restOperations().getForObject("https://www.facebook.com/any_user_name",
String.class); -- return html data/required json data
- facebook.restOperations().getForEntity("https://www.facebook.com/any_user_name",
JsonNode.class); - failled not able to parse