Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Implement a function which returns the list of users whom you follow, but doesn't follow back. #119

Open
Muhammed-Rajab opened this issue Jul 31, 2022 · 4 comments

Comments

@Muhammed-Rajab
Copy link
Contributor

Feature recommendation

Implement a function which returns the list of users whom you follow, but doesn't follow back.

Pros of implementing this feature

  • Users don't have to write extra logic to fetch the data
  • Would be easier to pass the list to safelyUnfollowUserList to unfollow them.
@Muhammed-Rajab
Copy link
Contributor Author

I know how to implement this feature and have already implemented this locally. I would love to share the code here 💖💖

@mifi
Copy link
Owner

mifi commented Aug 2, 2022

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.

@Muhammed-Rajab
Copy link
Contributor Author

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.

@mifi
Copy link
Owner

mifi commented Aug 2, 2022

I mean JS generators. You can see

function getFollowersOrFollowingGenerator({ userId, getFollowers = false }) {

it returns the result of

async function* graphqlQueryUsers({ queryHash, getResponseProp, graphqlVariables: graphqlVariablesIn }) {

...which is a generator. meaning it will return batches of accounts instead of waiting for all to load. (yield keyword)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants