instagram4j / instagram4j

:camera: Instagram private API in Java
Apache License 2.0
915 stars 274 forks source link

FriendshipsFeeds - unable to fetch followers #631

Closed sanchezik closed 2 years ago

sanchezik commented 2 years ago

I faced with a problem in getting Followers (btw getting Followings is OK).

Here is my code: FeedUsersResponse response = new FriendshipsFeedsRequest(9999999999L, FriendshipsFeedsRequest.FriendshipsFeeds.FOLLOWERS, "0") .execute(client).join();

It always throws this Exception:

java.util.concurrent.CompletionException: com.github.instagram4j.instagram4j.exceptions.IGResponseException: unable to fetch followers

StackTrace looks like that:

Exception in thread "Timer-0" java.util.concurrent.CompletionException: com.github.instagram4j.instagram4j.exceptions.IGResponseException: unable to fetch followers at com.github.instagram4j.instagram4j.IGClient$1.handle(IGClient.java:86) at com.github.instagram4j.instagram4j.IGClient.lambda$sendRequest$5(IGClient.java:152) at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:986) at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:970) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2137) at com.github.instagram4j.instagram4j.IGClient$2.onResponse(IGClient.java:136) at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: com.github.instagram4j.instagram4j.exceptions.IGResponseException: unable to fetch followers at com.github.instagram4j.instagram4j.requests.IGRequest.parseResponse(IGRequest.java:72) at com.github.instagram4j.instagram4j.IGClient.lambda$sendRequest$4(IGClient.java:149) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642) ... 7 more

The same code works fine when I'm getting my own followings, using FriendshipsFeedsRequest.FriendshipsFeeds.FOLLOWING enumeration.

Also I've found that in library's tests in file friendships/FriendshipsTest.java -> method testFollowers() -> there are double testing of Followings. I suppose there should be Followers+Followings. Maybe the reason of that is the same as mine: it's just not worked properly for Followers :(

yorkeJohn commented 2 years ago

I am experiencing the same issue.

sanchezik commented 2 years ago

Meanwhile I noticed this Instagram's logic:

I've tried to make a wrapper for FriendshipsFeedsRequest, where there is an additional path param _searchsurface, but it didn't help. So the last difference betwen requests, which can cause an exception, is that encrypted _maxid param. Maybe it will help somehow somebody in solving the issue...

sanchezik commented 2 years ago

I found the solution: