{
"pagination":
{"next_max_tag_id": "AQCXof9d52l0OUMJPHt-mSJxx-p-zuH7GGDLnBv_3DhqR9LiBi8rgTw0HqAv6zHzWyar9C5_yUOmgqoZzB39OmNFELBEW7xBjkDm1tmff0RB52vJKYWt73wg61ww2XvrxCQ",
"next_max_id": "AQCXof9d52l0OUMJPHt-mSJxx-p-zuH7GGDLnBv_3DhqR9LiBi8rgTw0HqAv6zHzWyar9C5_yUOmgqoZzB39OmNFELBEW7xBjkDm1tmff0RB52vJKYWt73wg61ww2XvrxCQ",
"next_url": "https://api.instagram.com/v1/tags/love/media/recent?access_token=2121718149.3444044.98426ea4ac8445dc83aaace64b189ad2\u0026max_tag_id=AQCXof9d52l0OUMJPHt-mSJxx-p-zuH7GGDLnBv_3DhqR9LiBi8rgTw0HqAv6zHzWyar9C5_yUOmgqoZzB39OmNFELBEW7xBjkDm1tmff0RB52vJKYWt73wg61ww2XvrxCQ",
"next_min_id": "AQCNS5gC4sFLM5TDxwhOOBXYXU2NQGrGSaSLhPResOyHEeT5Pse_17otIZa6gpZaUFQqxNHTokaMH1ZIQt2Gbm3xur52blWeChQs3LDbqhOa8wRwFVHTVwTd79-12uWF3Ck", "min_tag_id": "AQCNS5gC4sFLM5TDxwhOOBXYXU2NQGrGSaSLhPResOyHEeT5Pse_17otIZa6gpZaUFQqxNHTokaMH1ZIQt2Gbm3xur52blWeChQs3LDbqhOa8wRwFVHTVwTd79-12uWF3Ck",
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"
}
,
"data":
[
{
"id": "1592546164972439952_5948080381",
"user":
{
"id": "5948080381",
"full_name": "From America To Africa LDR \u2764\ufe0f",
"profile_picture": "https://scontent.cdninstagram.com/t51.2885-19/s150x150/21148153_1465133843555656_2623564353101627392_a.jpg",
"username": "fromamericatoafrica17"
},
"images":
{
"thumbnail":
{
"width": 150,
"height": 150,
"url": "https://scontent.cdninstagram.com/t51.2885-15/s150x150/e35/c0.78.770.770/21147744_266508440508403_5257290165033893888_n.jpg"
},
"low_resolution":
{
"width": 320,
"height": 384,
"url": "https://scontent.cdninstagram.com/t51.2885-15/e35/p320x320/21147744_266508440508403_5257290165033893888_n.jpg"
},
"standard_resolution":
{
"width": 640,
"height": 769,
"url": "https://scontent.cdninstagram.com/t51.2885-15/sh0.08/e35/p640x640/21147744_266508440508403_5257290165033893888_n.jpg"
}
},
"created_time": "1504066318",
"caption":
{
"id": "17890734748067049",
"text": "Love it. Just love it. .\n#ldr #longdistancerelationship #puppylove #love #fromamericatoafrica",
"created_time": "1504066318",
"from":
{
"id": "5948080381",
"full_name": "From America To Africa LDR \u2764\ufe0f",
"profile_picture": "https://scontent.cdninstagram.com/t51.2885-19/s150x150/21148153_1465133843555656_2623564353101627392_a.jpg",
"username": "fromamericatoafrica17"
}
},
"user_has_liked": false,
"likes": {"count": 0},
"tags":
[
"ldr", "longdistancerelationship", "love", "puppylove", "fromamericatoafrica"],
"filter": "Normal", "comments": {"count": 0},
"type": "image",
"link": "https://www.instagram.com/p/BYZ3Eyjl8mQ/",
"location": null, "attribution": null, "users_in_photo": []
},
このjsonのユーザー名、プロフィール画像にアクセスする必要があります。androidのinstagram apiのJsonパーサー
private class Insta_search extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String uri = params[0];
BufferedReader bufferedReader = null;
try {
URL url = new URL(uri);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
StringBuilder sb = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String json;
while ((json = bufferedReader.readLine()) != null) {
sb.append(json + "\n");
}
return sb.toString().trim();
} catch (Exception e) {
return null;
}
}
protected void onPostExecute(String s) {
super.onPostExecute(s);
//PENDING_STUDENT_NAME.clear();
if (s != null) {
try {
// JSONArray arr = new JSONArray(s);
JSONObject jsonObj = (JSONObject) new JSONTokener(s)
.nextValue();
String name = jsonObj.getJSONObject("user").getString("id");
// DataModel mDatModel = new DataModel();
}
}
この私のコード..