I think that set_dont_unfollow_active_users will have to get all likes from posts.
It only get first 20 users for each post
Also I think it also check the first "n-1" posts. If you select only 1 posts, you will get a empty list and ERROR
I am using "get_active_users" function (that is what set_dont_unfollow_active_users uses) and it only gets first 20 users. I think it needs to scroll down.
Thanks a lot for your help
(similar to https://github.com/timgrossmann/InstaPy/issues/851 ?
This is the script that I am using to check it:
```from instapy import InstaPy
from instapy.util import get_active_users
def main():
try:
session = InstaPy(username='USERNAME', password='PASSWORD')
session.login()
# list of users who liked our media. ALSO check with 1 instead 2 posts
active_users = get_active_users(session.browser,session.username,2,session.logger)
session.logger.info('Active_users: %d', len(active_users))
print('Active_users: %d', len(active_users))
session.end()
quit()
except Exception as e:
print('Error desconocido: {}'.format(e))
if __name__ == '__main__':
main()
Hey @ortegafernando, it's a known issue, I have once looked into it for Jonas from the Slack channel and then I wrote a smart scroller which could scroll down through all dialog boxes, grab all usernames and when hits bottom it would switch to the next post, so all of usernames who liked your latest n posts was grabbed...
"_Also I think it also check the first "n-1" posts._" - you are right, the reason behind that is:
for count in range(1, posts):
line in get_active_users
function of util.py file,
it should be
for count in range(0, posts):
Currently InstaPy takes only the visible usernames in the opened dialog boxes without scrolling down, but if we did apply scrolling deep down and taking all usernames, then it would take some big time for people _with huge_ accaunts who gets about ~5k likes per posts, but good news is that we can add a new parameter to ask users to choose how many active users to grab per post..
If you really decide to grab entire active usernames, I can look into backups to find that solution laying somewhere..
Thanks a lot @uluQulu
Currently InstaPy takes only the visible usernames in the opened dialog boxes without scrolling down, but if we did apply scrolling deep down and taking all usernames, then it would take some big time for people with huge accaunts who gets about ~5k likes per posts, but good news is that we can add a new parameter to ask users to choose how many active users to grab per post..
I understand it, but I agree with you about adding a new parameter to limit how many active users to grab per post. If you put the limit = 0, you could get all users.
If you really decide to grab entire active usernames, I can look into backups to find that solution laying somewhere..
Please, if you know what I have to change in the python script it will be great !!!
I know a bit of VB.NET, Arduino, .... so I understand a little bit python scripts (a programmer will be always a programmer) but there are things that I can't do.
Hope your answer, or your pull request
Thanks a lot.
@uluQulu If you just paste the code here I can work on cleaning it up and make a pull request. Thanks!
Hey guys,
I've just added some slight changes from my new experiences with scrollers and also added a new _parameter_ to control the desired boundary.
To use, apply _the changes_ as below:
set_dont_unfollow_active_users
function: boundary
def set_dont_unfollow_active_users(self, enabled=False, posts=4, boundary=500): #we have added `boundary` parameter here with a default value of `500`
set_dont_unfollow_active_users
, pass that newly written parameter,active_users = get_active_users(self.browser,
self.username,
posts,
boundary, ##add this new line
self.logger)
time
at top of the file near other importsimport time
get_active_users
function with this newly gisted one: 馃殑I've tested several times, but if still there are some logical or mechanical errors or any misbehaviours, please notify, I will help!
P.S. This smart scroller is really cool, else than legacy scroller methods which is scrolling in pre-defined stochastic amounts, this one, once hits bottom of scroll dialog will detect and continue to the next post which will save us lots of time and requests to the server :)
Usage:
in your quickstart script, add the _newly written_ parameter, boundary
, to control the _behaviour of_ the feature
session.set_dont_unfollow_active_users(enabled=True, posts=5, boundary=100)
It has 3 states of _values_:
1. If you want not to scroll through opened dialog boxes and grab only the visible usernames _loaded by default_, use the value 0
:
session.set_dont_unfollow_active_users(enabled=True, posts=5, boundary=0)
(_the state above is equal to the current state as it is in the main repo files, it does not scroll at all.._)
2. If you want to grab all of the usernames of the likers from the given posts, use the value None
:
session.set_dont_unfollow_active_users(enabled=True, posts=5, boundary=None)
3. If you want to grab the usernames of the likers in the desired amount, use that amount!
session.set_dont_unfollow_active_users(enabled=True, posts=5, boundary=555) #555 is the desired amount
(_in the example above, if your post(s) has(have) more than 555 likers, it will grab only 555 usernames, also, if your post(s) has(have) less likers than 555, it will grab all of the usernames_)
@d7laungani Dave, it would help lots of people if you could PR馃帀
Good luck!
Thank you @uluQulu . I got it working with photos but it skips videos for now. I am going to look into that if I have time if not I will submit a pull request as is.
Side note: Does anyone know how to see the likes of a video on a desktop. Clicking the view count just shows the number of likes on a desktop.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this problem still occurs, please open a new issue
Most helpful comment
Thank you @uluQulu . I got it working with photos but it skips videos for now. I am going to look into that if I have time if not I will submit a pull request as is.
Side note: Does anyone know how to see the likes of a video on a desktop. Clicking the view count just shows the number of likes on a desktop.