1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-16 11:47:29 +00:00
This commit is contained in:
Austin Huang 2021-01-06 13:44:28 -05:00
parent c8dda21f9f
commit b7a40b7b39
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -1,5 +1,6 @@
package awais.instagrabber.utils; package awais.instagrabber.utils;
import android.net.Uri;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
@ -962,10 +963,15 @@ public final class ResponseBodyUtils {
} }
if (data.has("story_cta") && data.has("link_text")) { if (data.has("story_cta") && data.has("link_text")) {
JSONObject tappableObject = data.getJSONArray("story_cta").getJSONObject(0).getJSONArray("links").getJSONObject(0); JSONObject tappableObject = data.getJSONArray("story_cta").getJSONObject(0).getJSONArray("links").getJSONObject(0);
String swipeUpUrl = tappableObject.getString("webUri"); String swipeUpUrl = tappableObject.optString("webUri");
if (swipeUpUrl.startsWith("http")) { final String backupSwipeUpUrl = swipeUpUrl;
model.setSwipeUp(new SwipeUpModel(swipeUpUrl, data.getString("link_text"))); if (swipeUpUrl != null && swipeUpUrl.startsWith("https://l.instagram.com/") {
swipeUpUrl = Uri.parse(swipeUpUrl).getQueryParameter("u");
} }
if (swipeUpUrl != null && swipeUpUrl.startsWith("http"))
model.setSwipeUp(new SwipeUpModel(swipeUpUrl, data.getString("link_text")));
else if (backupSwipeUpUrl != null && backupSwipeUpUrl.startsWith("http"))
model.setSwipeUp(new SwipeUpModel(backupSwipeUpUrl, data.getString("link_text")));
} }
if (data.has("story_sliders")) { if (data.has("story_sliders")) {
final JSONObject tappableObject = data.getJSONArray("story_sliders").getJSONObject(0) final JSONObject tappableObject = data.getJSONArray("story_sliders").getJSONObject(0)