Open Muhammed-Rajab opened 2 years ago
I know how to implement this feature and have already implemented this locally. I would love to share the code here 💖💖
feel free to create a PR. the only worry I have is that if you're following a lot of users, it will use a lot of time and many requests (probably risking getting blocked) in order to create a full list. Maybe better to expose the generator.
What do you mean by a generator?
Pseudo code of the current algorithm that I implemented to solve this problem looks like this
set_A = list of following
set_B = list of followers
set_C = A - B // Method to find the difference between two sets isn't available in Set class
safelyUnfollowUserList([...set_C])
This requires us to fetch both followers and following before hand, which means the code has to send multiple requests to fetch the data, if the number of followers / following is huge.
One of the way to eliminate the issue of getting banned is by sending less requests to the server, i.e, there has to be some time delay in between fetching the lists of followers and following.
I'll let you know if I found any way to work around this.
I mean JS generators. You can see https://github.com/mifi/instauto/blob/28c7010e89a36412fd710a2fd23a8a3fdaad7f18/src/index.js#L545
it returns the result of https://github.com/mifi/instauto/blob/28c7010e89a36412fd710a2fd23a8a3fdaad7f18/src/index.js#L504
...which is a generator. meaning it will return batches of accounts instead of waiting for all to load. (yield
keyword)
Feature recommendation
Implement a function which returns the list of users whom you follow, but doesn't follow back.
Pros of implementing this feature