InstaPy / InstaPy

πŸ“· Instagram Bot - Tool for automated Instagram interactions
GNU General Public License v3.0
16.73k stars 3.77k forks source link

follow_user_followers not working #996

Closed tgs266 closed 5 years ago

tgs266 commented 6 years ago

Expected Behavior

Should follow users of the account specified

Current Behavior

Outputs the following:

`INFO - Session started - 2017-11-26 07:24:57

INFO - Logged in successfully! INFO - --> Ongoing follow 1, now following: b'anthony7007' INFO - --> Ongoing follow 2, now following: b'gvoigt33' INFO - --> Ongoing follow 3, now following: b's_castanu' INFO - --> Ongoing follow 4, now following: b'brennecke19' INFO - --> Ongoing follow 5, now following: b'that.boi.dc' INFO - --> Total followNum reached: 5 INFO - --> Ongoing follow 1, now following: b'jude_segaline' INFO - --> Ongoing follow 2, now following: b'larsonsundown' INFO - --> Ongoing follow 3, now following: b'hunter.smith92' INFO - --> Ongoing follow 4, now following: b'sam.wilson30' INFO - --> Ongoing follow 5, now following: b'sweet_pete35' INFO - --> Total followNum reached: 5 INFO - --> Ongoing follow 1, now following: b'hunting_fishing802' INFO - --> Ongoing follow 2, now following: b'business.knights' INFO - --> Ongoing follow 3, now following: b'goon_gav' INFO - --> Ongoing follow 4, now following: b'97_____78.rin' INFO - --> Ongoing follow 5, now following: b't_haack' INFO - --> Total followNum reached: 5 INFO - --> Ongoing follow 1, now following: b'stups16' INFO - --> Ongoing follow 2, now following: b'chiefalu11' INFO - --> Ongoing follow 3, now following: b'grantchestnut13' INFO - --> Ongoing follow 4, now following: b'king..ever' INFO - --> Ongoing follow 5, now following: b'dan_bey1889' INFO - --> Total followNum reached: 5 WARNING - stxmlax -> Less users to follow than requested. WARNING - nblacrosse -> Less users to follow than requested. WARNING - There are 0 people to follow ERROR - following_link error list index out of range Traceback (most recent call last): File "laxgear4u.py", line 18, in if dic['bool_follow_user_followers']: session.follow_user_followers(dic['follow_user_followers'], amount=dic['amoun t_follow_user_followers'], randomize=False, sleep_delay=60) File "/home/tucker/InstaPy/instapy/instapy.py", line 1164, in follow_user_followers self.logger) File "/home/tucker/InstaPy/instapy/unfollow_util.py", line 720, in follow_given_user_followers allfollowing, UnboundLocalError: local variable 'allfollowing' referenced before assignment`

InstaPy configuration

Mine is a little complex. I'm using another python file to generate a dictionary so I can change parameters during runtime

`from instapy import InstaPy
import time
import config
from importlib import reload
session = InstaPy(username = '*****', password = '*******', nogui = True)
session.login()

while True:
    config = reload(config)
    dic = config.get_main_config()

    if dic['bool_set_do_comment']: session.set_comments(dic['set_comments'])
    if dic['bool_set_do_comment']: session.set_do_comment(enabled=True, percentage = dic['percentage_set_do_comment'])
    if dic['bool_set_do_follow']: session.set_do_follow(enabled=True, percentage = dic['percentage_set_do_follow'])
    if dic['bool_set_do_like']: session.set_do_like(enabled = True, percentage = dic['percentage_set_do_like'])

    if dic['bool_follow_user_followers']: session.follow_user_followers(dic['follow_user_followers'], amount=dic['amount_follow_user_followers'], randomize=False, sleep_delay=60)

    if dic['bool_like_by_feed']: session.like_by_feed(amount=dic['amount_like_by_feed'])

    if dic['bool_like_by_tags']: session.like_by_tags(dic['like_by_tags'], amount=dic['amount_like_by_tags'])

    if dic['bool_follow_user_followers']: session.follow_user_followers(dic['follow_user_followers'], amount=dic['amount_follow_user_followers'], randomize=False, sleep_delay=60)

    print ("Sleeping")
    time.sleep(dic['sleep_time'])

    if dic['bool_unfollow_users']: session.unfollow_users(amount=dic['amount_unfollow_users'], onlyInstapyFollowed = True, sleep_delay=30)

session.end()

`

Config file

def get_main_config():
    users = ['ecdlax', 'laxetc', 'lacrossenetwork', 'warriorlax', 'stxmlax', 'nblacrosse', 'rocketmeshlacrosse', 'angrybearlacrosse', 'maveriklacrosse', 'paulrabil', 'signaturesidewalls', 'clutchfanatic37', 'ualacrosse', 'stylin_strings', 'spartanstrings', 'stringking', 'universallax', 'lacrosseunlimited', 'teamstringking', 'throneofstring', 'playtruelax', 'gregbeast32']
    users_amt = 5
    dic = {
        'set_comments': [u'πŸ”₯πŸ”₯πŸ”₯', "Awesome!", 'Sweet!', "Nice!", u'πŸ‘πŸ‘πŸ‘πŸ‘', u'πŸ‘€', u'πŸ‘€πŸ‘€'],
        'bool_set_do_comment': False,
        'percentage_set_do_comment': 25,

        'bool_set_do_follow': True,
        'percentage_set_do_follow': 10,

        'bool_set_do_like': True,
        'percentage_set_do_like': 100,

        'bool_unfollow_users': True,
        'amount_unfollow_users': 125,

        'bool_like_by_feed': True,
        'amount_like_by_feed': 100,

        'bool_like_by_tags': True,
        'like_by_tags': ['lacrosse'],
        'amount_like_by_tags': 25,

        "bool_follow_user_followers": True,
        'follow_user_followers': users,
        'amount_follow_user_followers': users_amt,

        'sleep_time': 60 * 60
    }

    return dic

def get_interaction_config():
    users = ['ecdlax', 'laxetc', 'lacrossenetwork', 'warriorlax', 'stxmlax', 'nblacrosse', 'paulrabil', 'lacrossehub', 'stylin_strings', 'ualacrosse', 'spartanstrings', 'lacrosseunlimited', 'universallax', 'rocketmeshlacrosse', 'signaturesidewalls', 'clutchfanatic37', 'throneofstring', 'maveriklacrosse', 'playtruelax']
    users_amt = 3
    dic = {
        'set_comments': [u'πŸ”₯πŸ”₯πŸ”₯', "Awesome!", 'Sweet!', "Nice!", u'πŸ‘πŸ‘πŸ‘πŸ‘', u'πŸ‘€', u'πŸ‘€πŸ‘€'],
        'bool_set_do_comment': True,
        'percentage_set_do_comment': 60,

        'bool_set_do_follow': True,
        'percentage_set_do_follow': 10,

        'bool_set_do_like': True,
        'percentage_set_do_like': 100,

        "bool_interact_by_users": True,
        'interact_by_users': users,
        'amount_interact_by_users': users_amt,

        'sleep_time': 3 * 60 * 60

    }

    return dic
tgs266 commented 6 years ago

Just as an update, I watched the gui go into an account that fails to load followers. What looks like the problem is that the list of followers takes a while to update, and for the account I was testing with, never actually showed up at all. I'm assuming that this error shows up because the action of loading the followers times out, and it gives up, and moves on.

lologibus2 commented 6 years ago

Hi there same problem for me here

Any solutions on that issue ? Thks a lot

fegomess commented 6 years ago

Mine is exactly like the first comment. The bot stops and never goes back to other functions. Do any one know the solution for that? Tnks!

MedAdrian commented 6 years ago

Facing the same issue here, just as @tgs266 says it takes some time to load the followers from an account with say 4K or more followers, so the bot stops (manually scrolling down helps to this but it's not the way to go, especially when you got a csv with thousands of accounts).

ghost commented 6 years ago

I am having the same problem here. It happened with an account that had 765K+ followers

stale[bot] commented 5 years ago

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