1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-21 22:27:29 +00:00

fix graphql parse thumbnail

This commit is contained in:
Austin Huang 2021-03-27 10:41:31 -04:00
parent 4ef78bbe3f
commit ec592074be
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

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