Instagram: [standard_resolution] is not a JSONObject.
This commit is contained in:
parent
3a70c6f5ab
commit
7587961e90
@ -138,9 +138,15 @@ public class InstagramRipper extends AbstractJSONRipper {
|
||||
private String getMedia(JSONObject data) {
|
||||
String imageURL = "";
|
||||
if (data.has("videos")) {
|
||||
imageURL = data.getJSONObject("videos").getJSONObject("standard_resolution").getString("url");
|
||||
JSONObject videosObject = data.getJSONObject("videos");
|
||||
if (!videosObject.isNull("standard_resolution")) {
|
||||
imageURL = videosObject.getJSONObject("standard_resolution").getString("url");
|
||||
}
|
||||
} else if (data.has("images")) {
|
||||
imageURL = data.getJSONObject("images").getJSONObject("standard_resolution").getString("url");
|
||||
JSONObject imagesObject = data.getJSONObject("images");
|
||||
if (!imagesObject.isNull("standard_resolution")) {
|
||||
imageURL = imagesObject.getJSONObject("standard_resolution").getString("url");
|
||||
}
|
||||
}
|
||||
return imageURL;
|
||||
}
|
||||
@ -158,14 +164,14 @@ public class InstagramRipper extends AbstractJSONRipper {
|
||||
for (int carouselIndex = 0; carouselIndex < carouselMedias.length(); carouselIndex++) {
|
||||
JSONObject carouselMedia = (JSONObject) carouselMedias.get(carouselIndex);
|
||||
String imageURL = getMedia(carouselMedia);
|
||||
if (!imageURL.equals("")) {
|
||||
if (!"".equals(imageURL)) {
|
||||
imageURL = getOriginalUrl(imageURL);
|
||||
imageURLs.add(imageURL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String imageURL = getMedia(data);
|
||||
if (!imageURL.equals("")) {
|
||||
if (!"".equals(imageURL)) {
|
||||
imageURL = getOriginalUrl(imageURL);
|
||||
imageURLs.add(imageURL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user