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

byebye storiesig

This commit is contained in:
Austin Huang 2020-09-20 22:36:23 -04:00
parent 03bd549016
commit 6425fc3975
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
21 changed files with 17 additions and 62 deletions

View File

@ -19,25 +19,23 @@ import awais.instagrabber.utils.NetworkUtils;
public final class HighlightsFetcher extends AsyncTask<Void, Void, List<HighlightModel>> {
private final String id;
private final boolean storiesig;
private final FetchListener<List<HighlightModel>> fetchListener;
public HighlightsFetcher(final String id, final boolean storiesig, final FetchListener<List<HighlightModel>> fetchListener) {
public HighlightsFetcher(final String id, final FetchListener<List<HighlightModel>> fetchListener) {
this.id = id;
this.storiesig = storiesig;
this.fetchListener = fetchListener;
}
@Override
protected List<HighlightModel> doInBackground(final Void... voids) {
List<HighlightModel> result = null;
String url = "https://" + (storiesig ? "storiesig" : "i.instagram") + ".com/api/v1/highlights/" + id + "/highlights_tray/";
String url = "https://i.instagram.com/api/v1/highlights/" + id + "/highlights_tray/";
try {
HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setInstanceFollowRedirects(false);
conn.setUseCaches(false);
conn.setRequestProperty("User-Agent", storiesig ? Constants.A_USER_AGENT : Constants.I_USER_AGENT);
conn.setRequestProperty("User-Agent", Constants.I_USER_AGENT);
conn.connect();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {

View File

@ -30,7 +30,6 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
private String username;
private final boolean isLoc;
private final boolean isHashtag;
private final boolean storiesig;
private final boolean highlight;
private final FetchListener<StoryModel[]> fetchListener;
@ -38,14 +37,12 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
final String username,
final boolean isLoc,
final boolean isHashtag,
final boolean storiesig,
final boolean highlight,
final FetchListener<StoryModel[]> fetchListener) {
this.id = id;
this.username = username;
this.isLoc = isLoc;
this.isHashtag = isHashtag;
this.storiesig = storiesig;
this.highlight = highlight;
this.fetchListener = fetchListener;
}
@ -55,13 +52,7 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
StoryModel[] result = null;
final String userId = id.replace(":", "%3A");
final StringBuilder builder = new StringBuilder();
builder.append("https://");
if (storiesig) {
builder.append("storiesig");
} else {
builder.append("i.instagram");
}
builder.append(".com/api/v1/");
builder.append("https://i.instagram.com/api/v1/");
if (isLoc) {
builder.append("locations/");
}
@ -75,24 +66,20 @@ public final class iStoryStatusFetcher extends AsyncTask<Void, Void, StoryModel[
}
builder.append(userId);
if (!highlight) {
if (storiesig) {
builder.append("/reel_media/");
} else {
builder.append("/story/");
}
}
final String url = builder.toString();
try {
final HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
conn.setInstanceFollowRedirects(true);
conn.setUseCaches(false);
conn.setRequestProperty("User-Agent", storiesig ? Constants.A_USER_AGENT : Constants.I_USER_AGENT);
conn.setRequestProperty("User-Agent", Constants.I_USER_AGENT);
conn.setRequestProperty("Accept-Language", LocaleUtils.getCurrentLocale().getLanguage() + ",en-US;q=0.8");
conn.connect();
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
JSONObject data = new JSONObject(NetworkUtils.readFromConnection(conn));
if (!storiesig && !highlight)
if (!highlight)
data = data.optJSONObject((isLoc || isHashtag) ? "story" : "reel");
else if (highlight) data = data.getJSONObject("reels").optJSONObject(id);

View File

@ -286,7 +286,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
final Context context = getContext();
if (context == null) return;
if (isLoggedIn) {
new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, false, stories -> {
new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, stories -> {
if (stories != null && stories.length > 0) {
binding.mainHashtagImage.setStoriesBorder();
}

View File

@ -293,7 +293,6 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
true,
false,
false,
false,
stories -> {
if (stories != null && stories.length > 0) {
binding.mainLocationImage.setStoriesBorder();

View File

@ -544,7 +544,6 @@ public class StoryViewerFragment extends Fragment {
};
storiesService.getUserStory(currentStoryMediaId,
username,
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER) == StoryViewerChoice.STORIESIG.getValue(),
false,
false,
isHighlight,

View File

@ -441,12 +441,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
final String profileId = profileModel.getId();
if (settingsHelper.getString(Constants.STORY_VIEWER).equals(StoryViewerChoice.STORIESIG.getValue()) || isLoggedIn) {
if (isLoggedIn) {
new iStoryStatusFetcher(profileId,
profileModel.getUsername(),
false,
false,
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER).equals(StoryViewerChoice.STORIESIG.getValue()),
false,
result -> {
storyModels = result;
@ -455,7 +454,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new HighlightsFetcher(profileId,
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER).equals(StoryViewerChoice.STORIESIG.getValue()),
result -> {
if (result != null) {
binding.highlightsList.setVisibility(View.VISIBLE);

View File

@ -4,9 +4,8 @@ import java.io.Serializable;
public enum StoryViewerChoice implements Serializable {
NONE(0),
STORIESIG(1),
ALOINSTAGRAM(2),
INSTADP(3);
ALOINSTAGRAM(1),
INSTADP(2);
private int value;

View File

@ -98,14 +98,12 @@ public class StoriesService extends BaseService {
public void getUserStory(final String id,
final String username,
final boolean storiesig,
final boolean isLoc,
final boolean isHashtag,
final boolean highlight,
final ServiceCallback<List<StoryModel>> callback) {
final String url = buildUrl(id, storiesig, isLoc, isHashtag, highlight);
final String userAgent = storiesig ? Constants.A_USER_AGENT : Constants.I_USER_AGENT;
final Call<String> userStoryCall = repository.getUserStory(userAgent, url);
final String url = buildUrl(id, isLoc, isHashtag, highlight);
final Call<String> userStoryCall = repository.getUserStory(Constants.I_USER_AGENT, url);
userStoryCall.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull final Call<String> call, @NonNull final Response<String> response) {
@ -119,7 +117,7 @@ public class StoriesService extends BaseService {
}
data = new JSONObject(body);
if (!storiesig && !highlight)
if (!highlight)
data = data.optJSONObject((isLoc || isHashtag) ? "story" : "reel");
else if (highlight) data = data.getJSONObject("reels").optJSONObject(id);
@ -243,16 +241,10 @@ public class StoriesService extends BaseService {
});
}
private String buildUrl(final String id, final boolean storiesig, final boolean isLoc, final boolean isHashtag, final boolean highlight) {
private String buildUrl(final String id, final boolean isLoc, final boolean isHashtag, final boolean highlight) {
final String userId = id.replace(":", "%3A");
final StringBuilder builder = new StringBuilder();
builder.append("https://");
if (storiesig) {
builder.append("storiesig");
} else {
builder.append("i.instagram");
}
builder.append(".com/api/v1/");
builder.append("https://i.instagram.com/api/v1/");
if (isLoc) {
builder.append("locations/");
}
@ -266,12 +258,8 @@ public class StoriesService extends BaseService {
}
builder.append(userId);
if (!highlight) {
if (storiesig) {
builder.append("/reel_media/");
} else {
builder.append("/story/");
}
}
return builder.toString();
}
}

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Deaktivieren</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>غیرفعال</item>
<item>استوری های ig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Nonaktifkan</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disattiva</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Devredışı Bırak</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>禁用</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>

View File

@ -42,7 +42,6 @@
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>