Browse Source

fix graphql parse thumbnail

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
ec592074be
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 20
      app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java

20
app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java

@ -729,15 +729,19 @@ public final class ResponseBodyUtils {
width = dimensions.optInt("width");
}
String thumbnailUrl = null;
final JSONArray displayResources = feedItem.getJSONArray("display_resources");
final List<MediaCandidate> candidates = new ArrayList<MediaCandidate>();
for (int i = 0; i < displayResources.length(); i++) {
final JSONObject displayResource = displayResources.getJSONObject(i);
candidates.add(new MediaCandidate(
displayResource.getInt("config_width"),
displayResource.getInt("config_height"),
displayResource.getString("src")
));
if (feedItem.has("display_resources") || feedItem.has("thumbnail_resources")) {
final JSONArray displayResources = feedItem.has("display_resources")
? feedItem.getJSONArray("display_resources")
: feedItem.getJSONArray("thumbnail_resources");
for (int i = 0; i < displayResources.length(); i++) {
final JSONObject displayResource = displayResources.getJSONObject(i);
candidates.add(new MediaCandidate(
displayResource.getInt("config_width"),
displayResource.getInt("config_height"),
displayResource.getString("src")
));
}
}
final ImageVersions2 imageVersions2 = new ImageVersions2(candidates);

Loading…
Cancel
Save