spring social facebook - 如何从其他用户的公开个人资料中获取用户数据或帖子

时间:2018-06-13 17:55:28

标签: spring-social-facebook

我想从公共网址中抓取另一个用户帖子,例如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

0 个答案:

没有答案