Instagram: [standard_resolution] is not a JSONObject.

Improvement after feedback
This commit is contained in:
Jozsef.Kerekes 2017-10-06 21:04:28 +03:00 committed by metaprime
parent 7587961e90
commit 0c995f67f0

View File

@ -137,13 +137,14 @@ public class InstagramRipper extends AbstractJSONRipper {
private String getMedia(JSONObject data) {
String imageURL = "";
JSONObject mediaObject;
if (data.has("videos")) {
JSONObject videosObject = data.getJSONObject("videos");
mediaObject = data.getJSONObject("videos");
if (!videosObject.isNull("standard_resolution")) {
imageURL = videosObject.getJSONObject("standard_resolution").getString("url");
}
} else if (data.has("images")) {
JSONObject imagesObject = data.getJSONObject("images");
mediaObject = data.getJSONObject("images");
if (!imagesObject.isNull("standard_resolution")) {
imageURL = imagesObject.getJSONObject("standard_resolution").getString("url");
}