Set time-frame to unfollow
Closed this issue · 1 comments
Hi Farzany,
I am new to using Python and recently started learning. And tried to implement your code for follow-unfollow bot on Instagram.
However, there is an additional if function I wanted to add and was having difficulty identifying what code should be used and where to put it, required function as below:
When unfollowing from followed list, only unfollow after username has been in the list for x amount of days and keep the rest.
What would be the code? and should it be added in the def UnfollowedFollowed? remFollowedList? or Unfollowuser?
Your help will be massively appreciated.
Thanks!
Gaurav
Hello! I have yet to deal with time in Python other than making the program sleep/wait for a few seconds. Off the top of my head, you could try the following:
- Attach a time stamp when writing a username to the followed file. For example: USERNAME [day/month/year]
- When reading the file to store the usernames in your "followed list", you could neglect usernames where the timestamp's DAY counter is not 3 less than the current day. For example: USERNAME [25/5/2021] would be neglected if today was [27/5/2021] but would be added to the list if today was [28/5/2021].
Reading and sorting these usernames would be somewhat tedious (especially if the timestamp spills into the next month - you would need to do some math). You can decide where to add this extra code - it could be in the ReadFiles() method, or you could filter out the usernames within the methods you mentioned, or even create a new method to do it. I do not think this solution is the best for what you are trying to achieve, but it's simply an idea. Goodluck! I hope you figure this out :)