Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
9 changed files with 119 additions and 123 deletions
-
51app/src/main/java/awais/instagrabber/asyncs/SeenAction.java
-
2app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/StoryListViewerFragment.java
-
36app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
-
2app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
-
4app/src/main/java/awais/instagrabber/repositories/StoriesRepository.java
-
95app/src/main/java/awais/instagrabber/webservices/StoriesService.java
@ -1,51 +0,0 @@ |
|||
package awais.instagrabber.asyncs; |
|||
|
|||
import android.os.AsyncTask; |
|||
import android.util.Log; |
|||
|
|||
import java.io.DataOutputStream; |
|||
import java.net.HttpURLConnection; |
|||
import java.net.URL; |
|||
|
|||
import awais.instagrabber.models.StoryModel; |
|||
import awais.instagrabber.utils.NetworkUtils; |
|||
|
|||
public class SeenAction extends AsyncTask<Void, Void, Void> { |
|||
private static final String TAG = "SeenAction"; |
|||
|
|||
private final String cookie; |
|||
private final StoryModel storyModel; |
|||
|
|||
public SeenAction(final String cookie, final StoryModel storyModel) { |
|||
this.cookie = cookie; |
|||
this.storyModel = storyModel; |
|||
} |
|||
|
|||
protected Void doInBackground(Void... voids) { |
|||
final String url = "https://www.instagram.com/stories/reel/seen"; |
|||
try { |
|||
final String urlParameters = "reelMediaId=" + storyModel.getStoryMediaId().split("_")[0] |
|||
+ "&reelMediaOwnerId=" + storyModel.getUserId() |
|||
+ "&reelId=" + storyModel.getUserId() |
|||
+ "&reelMediaTakenAt=" + storyModel.getTimestamp() |
|||
+ "&viewSeenAt=" + storyModel.getTimestamp(); |
|||
final HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection(); |
|||
urlConnection.setRequestMethod("POST"); |
|||
urlConnection.setUseCaches(false); |
|||
urlConnection.setRequestProperty("x-csrftoken", cookie.split("csrftoken=")[1].split(";")[0]); |
|||
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); |
|||
urlConnection.setRequestProperty("Content-Length", Integer.toString(urlParameters.getBytes().length)); |
|||
urlConnection.setDoOutput(true); |
|||
DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream()); |
|||
wr.writeBytes(urlParameters); |
|||
wr.flush(); |
|||
wr.close(); |
|||
urlConnection.connect(); |
|||
Log.d(TAG, urlConnection.getResponseCode() + " " + NetworkUtils.readFromConnection(urlConnection)); |
|||
urlConnection.disconnect(); |
|||
} catch (Throwable ex) { |
|||
Log.e(TAG, "Error", ex); |
|||
} |
|||
return null; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue