How to use the instapy.unfollow_util.follow_user function in instapy

To help you get started, we’ve selected a few instapy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Instagram-Tools / bot / instapy / instapy.py View on Github external
links = get_links_for_username(
                    self.browser,
                    username,
                    amount,
                    self.logger,
                    randomize,
                    media)
            except NoSuchElementException:
                self.logger.error('Element not found, skipping this username')
                continue

            if (self.do_follow and
                username not in self.dont_include and
                following and
                    self.follow_restrict.get(username, 0) < self.follow_times):
                followed += follow_user(self.browser,
                                        self.follow_restrict,
                                        self.username,
                                        username,
                                        self.blacklist,
                                        self.logger,
                                        self.logfolder)
            else:
                self.logger.info('--> Not following')
                sleep(1)

            if links is False:
                continue

            # Reset like counter for every username
            liked_img = 0
github Instagram-Tools / bot / instapy / instapy.py View on Github external
self.logger,
                                                               self.logfolder)
                                else:
                                    self.logger.info(disapproval_reason)
                            else:
                                self.logger.info('--> Not commented')
                                sleep(1)

                            if (self.do_follow and
                                user_name not in self.dont_include and
                                checked_img and
                                following and
                                self.follow_restrict.get(user_name, 0) <
                                    self.follow_times):

                                followed += follow_user(self.browser,
                                                        self.follow_restrict,
                                                        self.username,
                                                        user_name,
                                                        self.blacklist,
                                                        self.logger,
                                                        self.logfolder)

                            else:
                                self.logger.info('--> Not following')
                                sleep(1)
                        else:
                            already_liked += 1
                    else:
                        self.logger.info(
                            '--> Image not liked: {}'.format(reason.encode('utf-8')))
                        inap_img += 1
github Instagram-Tools / bot / instapy / instapy.py View on Github external
self.logFile.write('Username [{}/[]]'.format(index + 1, len(usernames)))
            self.logFile.write('--> {}\n'.format(username.encode('utf-8')))
            following = randint(0, 100) <= self.follow_percentage

            try:
                links = get_links_for_username(self.browser, username, amount, random, media)
            except NoSuchElementException:
                print('Element not found, skipping this username')
                self.logFile.write('Element not found, skipping this username\n')

                continue

            if self.do_follow and username not in self.dont_include \
                    and following \
                    and self.follow_restrict.get(username, 0) < self.follow_times:
                followed += follow_user(self.browser, self.follow_restrict, self.username, username)
            else:
                print('--> Not following')
                sleep(1)

            if links == False:
                continue

            # Reset like counter for every username
            liked_img = 0

            for i, link in enumerate(links):
                # Check if target has reached
                if liked_img >= amount:
                    print('-------------')
                    print("--> Total liked image reached it's amount given: ", liked_img)
                    print('')
github Instagram-Tools / bot / instapy / instapy.py View on Github external
check_link(self.browser,
                                   link,
                                   self.dont_like,
                                   self.ignore_if_contains,
                                   self.logger)
                    )

                    if not inappropriate:

                        if (self.do_follow and
                            username not in self.dont_include and
                            following and
                            self.follow_restrict.get(
                                username, 0) < self.follow_times):

                            followed += follow_user(
                                self.browser,
                                self.follow_restrict,
                                self.username,
                                username,
                                self.blacklist,
                                self.logger,
                                self.logfolder)

                            following = False
                        else:
                            self.logger.info('--> Not following')
                            sleep(1)

                        liking = random.randint(0, 100) <= self.like_percentage
                        
                        if self.do_like and liking and self.delimit_liking:
github Instagram-Tools / bot / instapy / instapy.py View on Github external
if temp_comments:
                                            # Use clarifai related comments only!
                                            comments = temp_comments
                                        elif is_video:
                                            comments = self.comments + self.video_comments
                                        else:
                                            comments = self.comments + self.photo_comments
                                        commented += comment_image(self.browser, comments)
                                    else:
                                        print('--> Not commented')
                                        sleep(1)

                                    if self.do_follow and user_name not in self.dont_include \
                                            and checked_img and following \
                                            and self.follow_restrict.get(user_name, 0) < self.follow_times:
                                        followed += follow_user(self.browser, self.follow_restrict, self.username, user_name)
                                    else:
                                        print('--> Not following')
                                        sleep(1)
                                else:
                                    already_liked += 1
                            else:
                                print('--> Image not liked: {}'.format(reason))
                                inap_img += 1
                                if reason == 'Inappropriate':
                                    unfollow_user(self.browser)
                        except NoSuchElementException as err:
                            print('Invalid Page: {}'.format(err))
                            self.logFile.write('Invalid Page: {}\n'.format(err))

                        print('')
                        self.logFile.write('\n')