Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a minimal example for your problem: Note that you can get the access token and the page ID from <a href="https://developers.facebook.com/tools/explorer">https://developers.facebook.com/tools/explorer</a> Use this id below in your code:</p> <pre><code>import facebook4j.Comment; import facebook4j.Facebook; import facebook4j.FacebookException; import facebook4j.FacebookFactory; import facebook4j.PagableList; import facebook4j.Post; import facebook4j.Reading; import facebook4j.ResponseList; import facebook4j.auth.AccessToken; public class PostsFromPageExtractor { /** * A simple Facebook4J client which * illustrates how to access group feeds / posts / comments. * * @param args * @throws FacebookException */ public static void main(String[] args) throws FacebookException { // Generate facebook instance. Facebook facebook = new FacebookFactory().getInstance(); // Use default values for oauth app id. facebook.setOAuthAppId("", ""); // Get an access token from: // https://developers.facebook.com/tools/explorer // Copy and paste it below. String accessTokenString = "PASTE_YOUR_ACCESS_TOKEN_HERE"; AccessToken at = new AccessToken(accessTokenString); // Set access token. facebook.setOAuthAccessToken(at); // We're done. // Access group feeds. // You can get the group ID from: // https://developers.facebook.com/tools/explorer // Set limit to 25 feeds. ResponseList&lt;Post&gt; feeds = facebook.getFeed("187446750783", new Reading().limit(25)); // For all 25 feeds... for (int i = 0; i &lt; feeds.size(); i++) { // Get post. Post post = feeds.get(i); // Get (string) message. String message = post.getMessage(); // Print out the message. System.out.println(message); // Get more stuff... PagableList&lt;Comment&gt; comments = post.getComments(); String date = post.getCreatedTime().toString(); String name = post.getFrom().getName(); String id = post.getId(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload