0
我正在提取Facebook頁面的帖子詳細信息。我提取了特定頁面的json,現在我必須獲得該頁面所有帖子的id。我怎樣才能使用facebook4j做到這一點。如何獲得facebook中特定頁面的所有帖子ID
private static String readpage(Reader rd) throws IOException
{
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1)
{
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject readurl(String url) throws IOException, JSONException
{
InputStream is = new URL(url).openStream();
try
{
BufferedReader rd = new BufferedReader(new InputStreamReader
(is, Charset.forName("UTF-8")));
String jsonText = readpage(rd);
JSONObject json = new JSONObject(jsonText);
return json;
}
finally
{
is.close();
}
}
public static void main(String[] args) throws
IOException, JSONException, FacebookException
{
JSONObject json = readurl("https://graph.facebook.com/"+s);
}