1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 13:26:59 +00:00

fix feed oops

This commit is contained in:
Austin Huang 2020-11-13 18:37:19 -05:00
parent 0487d23907
commit 44b431b533
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 7 additions and 4 deletions

View File

@ -671,6 +671,7 @@ public final class ResponseBodyUtils {
} }
final JSONObject feedItem = itemJson.getJSONObject("node"); final JSONObject feedItem = itemJson.getJSONObject("node");
final String mediaType = feedItem.optString("__typename"); final String mediaType = feedItem.optString("__typename");
if ("GraphSuggestedUserFeedUnit".equals(mediaType)) return null;
final boolean isVideo = feedItem.optBoolean("is_video"); final boolean isVideo = feedItem.optBoolean("is_video");
final long videoViews = feedItem.optLong("video_view_count", 0); final long videoViews = feedItem.optLong("video_view_count", 0);

View File

@ -84,10 +84,10 @@ public class FeedService extends BaseService {
return; return;
} }
final Map<String, String> queryMap = new HashMap<>(); final Map<String, String> queryMap = new HashMap<>();
queryMap.put("query_hash", "6b838488258d7a4820e48d209ef79eb1"); queryMap.put("query_hash", "c699b185975935ae2a457f24075de8c7");
queryMap.put("variables", "{" + queryMap.put("variables", "{" +
"\"fetch_media_item_count\":" + maxItemsToLoad + "," + "\"fetch_media_item_count\":" + maxItemsToLoad + "," +
"\"has_threaded_comments\":true," + "\"fetch_like\":3,\"has_stories\":false,\"has_stories\":false,\"has_threaded_comments\":true," +
"\"fetch_media_item_cursor\":\"" + (cursor == null ? "" : cursor) + "\"" + "\"fetch_media_item_cursor\":\"" + (cursor == null ? "" : cursor) + "\"" +
"}"); "}");
final Call<String> request = repository.fetch(queryMap); final Call<String> request = repository.fetch(queryMap);
@ -154,8 +154,10 @@ public class FeedService extends BaseService {
if (itemJson == null) { if (itemJson == null) {
continue; continue;
} }
final FeedModel feedModel = ResponseBodyUtils.parseItem(itemJson); final FeedModel feedModel = ResponseBodyUtils.parseGraphQLItem(itemJson);
feedModels.add(feedModel); if (feedModel != null) {
feedModels.add(feedModel);
}
} }
return new PostsFetchResponse(feedModels, hasNextPage, endCursor); return new PostsFetchResponse(feedModels, hasNextPage, endCursor);
} }