subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.37k stars 684 forks source link

See/Accept Follow Request #816

Open vapefy opened 2 years ago

vapefy commented 2 years ago

Are there any methods to see and accept the follow requests when the account is private?

adw0rd commented 2 years ago

@vapefy I didn't implement it, but you can help me to do it yourself and send a PR

vapefy commented 2 years ago

@adw0rd okay, i will do what i can.

sekoakb commented 1 year ago

@vapefy , hi did you have a chance to solve it?

birdhouses commented 1 year ago

If nobody is working on this issue, I'd be happy to help! I'll see what I can do to implement this. Edit (03-07-2023): Haven't gotten around to work on this issue yet, feel free to pick it up!

sekoakb commented 1 year ago

I found a different approach, for a couple seconds set account to public then back private. It auto approves all pendings..

oneYAD commented 1 year ago

If nobody is working on this issue, I'd be happy to help! I'll see what I can do to implement this.

Did you continue to implement this? I am trying to filter the followers I want to accept, so auto approve all is not good enough

birdhouses commented 1 year ago

@oneYAD No, I have been putting work in other projects lately. Feel free to pick it up if you want! I will update my comment to avoid confusion.

oneYAD commented 1 year ago

@oneYAD No, I have been putting work in other projects lately. Feel free to pick it up if you want! I will update my comment to avoid confusion.

Do you have a lead?

birdhouses commented 1 year ago

@oneYAD No, I haven't. But I'd be happy to help if you have questions about the development!

birdhouses commented 1 year ago

@oneYAD If you don't know / want / etc. to contribute to the instagrapi directly, I would make something that firstly gets all the current followers of your account. Save those followers somewhere (.txt, .json, etc.) . Then manually accept all the follow requests, and loop over all the new followers, then check each new follower if it matches your requirements and based on that unfollow / keep following the user

oneYAD commented 1 year ago

@oneYAD If you don't know / want / etc. to contribute to the instagrapi directly, I would make something that firstly gets all the current followers of your account. Save those followers somewhere (.txt, .json, etc.) . Then manually accept all the follow requests, and loop over all the new followers, then check each new follower if it matches your requirements and based on that unfollow / keep following the user

I am fine with contribute if the solution will be fit, but I don't see one right now. your solution is little tricky and I trying to think about more 'smooth' option

birdhouses commented 1 year ago

@oneYAD I'll try to help you find a lead right now, I have a bit of time this evening.

birdhouses commented 1 year ago

I've stumbled on this: https://github.com/sem/Instagram-Request-Scanner https://stackoverflow.com/questions/55706145/how-to-get-the-exact-number-of-follow-requests-on-an-instagram-account-after-re

It seems like it's possible to retrieve the incoming follow requests with the https://i.instagram.com/api/v1/news/inbox/friendships/pending/ endpoint.

I don't know if this endpoint is still active at the moment, but it seems likely.

oneYAD commented 1 year ago

I've stumbled on this: https://github.com/sem/Instagram-Request-Scanner https://stackoverflow.com/questions/55706145/how-to-get-the-exact-number-of-follow-requests-on-an-instagram-account-after-re

It seems like it's possible to retrieve the incoming follow requests with the https://i.instagram.com/api/v1/news/inbox/friendships/pending/ endpoint.

I don't know if this endpoint is still active at the moment, but it seems likely.

Yes, I find it also here - https://github.com/michaeltikhonovsky/instagram_accepter_bot. tnx

oleksandrtur commented 8 months ago

Add this code to instagrapi

def get_pending_users(self):
    
  result = self.private_request("friendships/pending?")
  return result["users"]

def approve_user(self, pk_id):
    
  body = {
        "_uid": self.user_id,
        "_uuid": self.uuid,
        "_csrftoken": self.token,
        "user_id": pk_id
    }
    
  result = self.private_request(f"friendships/approve/{pk_id}/", data=json.dumps(body), with_signature=True)
    
  return result