I tried to write an automatic program with python and selenium to create automated Instagram accounts. I have added all security options and even Instagram prevents me from creating new accounts.

I literally tried everything. Cleaning cookies, catch, incognito-mode, proxy, disabled location, used fake headers and at last I tried a new internet connection (Hotspot by my smartphone). But Instagram still blocks me. How can I modify my code to prevent Instagram me from being detected as me?

The InstaAction class only calls storage.clear()

class MyInstaAction(webdriver.Chrome):
    def __init__(self, *args, **kwargs):
        super().__init__('chromedriver.exe', *args, **kwargs)

    def root(self):
        self.get(mpaths.root)

    def create_account(self, user):
        self.get(mpaths.register)
        self.execute_script('localStorage.clear();')

        # Finding elements and doing other stuff

"Main" securety settings

    if mconf.use_proxy:
        proxies = my_proxys.get_proxys()

        if count > len(proxies):
            print(f'Only {len(proxies)} available\n'
                  f'Setting counter to maximum of {len(proxies)}')
            count = len(proxies)
    else:
        proxies = [0 for _ in range(count)]

    for i, proxy in zip(range(count), proxies):
        try:
            user = MyUserFactory.get_user()
            if doc.does_user_exist(user):
                same += 1
                continue

            opt = webdriver.ChromeOptions()
            opt.add_argument("disable-infobars")
            opt.add_argument("--incognito")
            prefs = {"profile.default_content_setting_values.geolocation": 2}
            opt.add_experimental_option("prefs", prefs)
            ua = rua.random
            print(ua)
            opt.add_argument(f"user-agent={ua}")
            opt.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
            if proxy:
                # Setting up proxy package
                opt.add_argument('--proxy-server=%s' % proxy)

            # end
            iact = MyInstaAction(options=opt)
            iact.delete_all_cookies()

Does anybody how to get around this problem?

Error Message

1 Answers

0
Community On

Try to change the user-agent. options.add_argument("user-agent=YOUR_DEVICE")