def follow_protocol(self):
    limit = random.randint(5, 10)
    while self.follow_counter < limit:
        chooser = 0
        if len(self.user_info_list) > 0:
            chooser = random.randint(0, len(self.user_info_list) - 1)
            self.current_user = self.user_info_list[chooser][0]
            self.current_id = self.user_info_list[chooser][1]
            print('=============== \nCheck profile of ' + self.current_user +
                  '\n===============')
            get_user_info(self, self.current_user)
        else:
            print('xxxxxxx user info list is empty!!! xxxxxxxxx')
            feed_scanner(self)
        if self.is_selebgram != True and self.is_fake_account != True and self.is_active_user != False:
            if self.is_following != True:
                print('Trying to follow : ' + self.current_user +
                      ' with user ID :' + self.current_id)
                self.follow(self.current_id)
                print('delete ' + self.user_info_list[chooser][0] +
                      ' from user info list')
                del self.user_info_list[chooser]
        else:
            print('delete ' + self.user_info_list[chooser][0] +
                  ' from user info list')
            del self.user_info_list[chooser]

        time.sleep(random.randint(13, 26))
Exemplo n.º 2
0
def follow_protocol(self):
    limit = random.randint(5, 10)
    while self.follow_counter < limit:
        chooser = 0
        if len(self.user_info_list) > 0:
            chooser = random.randint(0, len(self.user_info_list) - 1)
            self.current_user = self.user_info_list[chooser][0]
            self.current_id = self.user_info_list[chooser][1]
            print('=============== \nCheck profile of ' + self.current_user +
                  '\n===============')
            get_user_info(self, self.current_user)
        else:
            print('xxxxxxx user info list is empty!!! xxxxxxxxx')
            feed_scanner(self)
        if self.is_selebgram != True and self.is_fake_account != True and self.is_active_user != False:
            if self.is_following != True:
                print('Trying to follow : ' + self.current_user +
                      ' with user ID :' + self.current_id)
                self.follow(self.current_id)
                print('delete ' + self.user_info_list[chooser][0] +
                      ' from user info list')
                del self.user_info_list[chooser]
        else:
            print('delete ' + self.user_info_list[chooser][0] +
                  ' from user info list')
            del self.user_info_list[chooser]

        time.sleep(random.randint(13, 26))
Exemplo n.º 3
0
def check_status(self):
    self.is_self_checking = True
    self.is_checked = False
    while self.is_checked != True:
        get_user_info(self, self.user_login)
    self.like_counter = 0
    self.follow_counter = 0
    self.unfollow_counter = 0
Exemplo n.º 4
0
def check_status(self):
    self.is_self_checking = True
    self.is_checked = False
    while self.is_checked != True:
        get_user_info(self, self.user_login)
    self.like_counter = 0
    self.follow_counter = 0
    self.unfollow_counter = 0
Exemplo n.º 5
0
def get_media_id_user_feed(self):
    if (self.login_status):
        if self.is_by_tag is not True:
            log_string = "======> Get media id by user: %s <======" % (self.current_user)
            if self.is_checked is not True:
                get_user_info(self, self.current_user)
            if self.is_fake_account is False and self.is_active_user and self.is_selebgram is False or self.is_by_tag:
                url = 'https://www.instagram.com/%s%s' % (self.current_user, '/')
        else:
            log_string = "======> Get media id by Tag <======"
            url = 'https://www.instagram.com/explore/tags/%s' % (random.choice(self.tag_list))
        self.write_log(log_string)

        if self.login_status == 1 and self.is_fake_account is False\
                and self.is_active_user and self.is_selebgram is False or self.is_by_tag:
            try:
                r = self.s.get(url)
                text = r.text

                finder_text_start = ('<script type="text/javascript">'
                                     'window._sharedData = ')
                finder_text_start_len = len(finder_text_start)-1
                finder_text_end = ';</script>'

                all_data_start = text.find(finder_text_start)
                all_data_end = text.find(finder_text_end, all_data_start + 1)
                json_str = text[(all_data_start + finder_text_start_len + 1):all_data_end]
                all_data = json.loads(json_str)

                if self.is_by_tag is not True:
                    self.media_by_user = list(all_data['entry_data']['ProfilePage'][0]
                                                      ['user']['media']['nodes'])
                else:
                    self.media_by_user = list(all_data['entry_data']['TagPage'][0]
                                                      ['tag']['media']['nodes'])
                log_string = "Get media by user success!"
                self.write_log(log_string)
            except:
                self.media_by_user = []
                self.write_log("XXXXXXX Except on get_media! XXXXXXX")
                time.sleep(60)
                return 0
        else:
            log_string = """
            Reject this account
            ===================
            Reason:
                Is Selebgram : %s
                Is Fake Account : %s
                Is Active User : %s
            """ % (self.is_selebgram, self.is_fake_account, self.is_active_user)
            self.write_log(log_string)
            self.is_rejected = True
            self.media_by_user = []
            self.media_on_feed = []
            return 0
Exemplo n.º 6
0
def follow_protocol(self):
    #    for index in range(len(self.old_following_list)):
    #        if self.old_following_list[index] in self.current_id :
    #            print("this user ( " + self.current_user + " ) is in your old following list !!")
    #            return 0
    limit = 1000000
    self.follow_counter = 0
    while self.follow_counter < limit:
        chooser = 0
        if len(self.user_info_list) > 0:
            chooser = random.randint(0, len(self.user_info_list) - 1)
            self.current_user = self.user_info_list[chooser][0]
            self.current_id = self.user_info_list[chooser][1]
            print('=============== \nCheck profile of ' + self.current_user +
                  '\n===============')
            get_user_info(self, self.current_user)
        else:
            print('xxxxxxx user info list is empty!!! xxxxxxxxx')
            feed_scanner(self)
        if self.is_fake_account != True and self.is_active_user != False and self.is_selebgram != True:
            if self.is_following != True:
                folthis = False
                if self.is_private is False:
                    print self.like_ratio
                    if self.like_ratio < 101:
                        folthis = user_feed_protocol(self)
                        if not folthis:
                            time.sleep(
                                random.randint(3, 5) * random.randint(30, 60))
                        else:
                            time.sleep(
                                random.randint(4, 10) * random.randint(7, 12))
                    self.like_counter = 0
                    self.media_by_user = []
                else:
                    folthis = True

                if folthis:
                    print('Trying to follow : ' + self.current_user +
                          ' with user ID :' + self.current_id)
                    self.follow(self.current_id)
                    time.sleep(random.randint(4, 10) * random.randint(7, 12))
            print('delete ' + self.user_info_list[chooser][0] +
                  ' from user info list')
            del self.user_info_list[chooser]

        else:
            print('delete ' + self.user_info_list[chooser][0] +
                  ' from user info list')
            del self.user_info_list[chooser]
        time.sleep(random.randint(3, 15))
Exemplo n.º 7
0
def get_media_id_user_feed (self):
    if (self.login_status):
        if self.is_by_tag != True :
            log_string = "======> Get media id by user: %s <======" % (self.current_user)
            if self.is_checked != True :
                get_user_info(self, self.current_user)
            if self.is_fake_account!=True and self.is_active_user!=False and self.is_selebgram!=True or self.is_by_tag !=False:
                url = 'https://www.instagram.com/%s%s' % (self.current_user, '/')
        else :
            log_string = "======> Get media id by Tag <======"
            url = 'https://www.instagram.com/explore/tags/%s' % (random.choice(self.tag_list))
        self.write_log(log_string)

        if self.login_status == 1 and self.is_fake_account!=True and self.is_active_user!=False and self.is_selebgram!=True or self.is_by_tag !=False :
            try :
                r = self.s.get(url)
                text = r.text

                finder_text_start = ('<script type="text/javascript">'
                                         'window._sharedData = ')
                finder_text_start_len = len(finder_text_start)-1
                finder_text_end = ';</script>'

                all_data_start = text.find(finder_text_start)
                all_data_end = text.find(finder_text_end, all_data_start + 1)
                json_str = text[(all_data_start + finder_text_start_len + 1) \
                                   : all_data_end]
                all_data = json.loads(json_str)
             
                if self.is_by_tag!= True :
                    self.media_by_user = list(all_data['entry_data']['ProfilePage'][0]\
                                            ['user']['media']['nodes'])
                else :
                    self.media_by_user = list(all_data['entry_data']['TagPage'][0]\
                                            ['tag']['media']['nodes'])
                log_string="Get media by user success!"
                self.write_log(log_string)
            except:
                self.media_by_user = []
                self.write_log("XXXXXXX Except on get_media! XXXXXXX")
                time.sleep(60)
                return 0
        else:
            log_string = "Reject this account \n=================== \nReason : \n   Is Selebgram : %s \n   Is Fake Account : %s \n   Is Active User : %s \n" % (self.is_selebgram, self.is_fake_account, self.is_active_user)
            self.write_log(log_string)
            self.is_rejected = True
            self.media_by_user = []
            self.media_on_feed = []
            return 0
def get_media_id_user_feed(self):
    if self.login_status:
        if self.is_by_tag != True:
            log_string = "======> Get media id by user: %s <======" % (
                self.current_user)
            if self.is_checked != True:
                get_user_info(self, self.current_user)
            if self.is_fake_account != True and self.is_active_user != False and self.is_selebgram != True or self.is_by_tag != False:
                url = 'https://www.instagram.com/%s/?__a=1' % (
                    self.current_user)
        else:
            log_string = "======> Get media id by Tag <======"
            url = 'https://www.instagram.com/explore/tags/%s/?__a=1' % (
                random.choice(self.tag_list))
        self.write_log(log_string)

        if self.login_status == 1 and self.is_fake_account != True and self.is_active_user != False and self.is_selebgram != True or self.is_by_tag != False:
            try:
                r = self.s.get(url)
                all_data = json.loads(r.text)

                if self.is_by_tag != True:
                    self.media_by_user = list(
                        all_data['user']['media']['nodes'])
                else:
                    self.media_by_user = list(
                        all_data['tag']['media']['nodes'])
                log_string = "Get media by user success!"
                self.write_log(log_string)
            except:
                self.media_by_user = []
                self.write_log("XXXXXXX Except on get_media! XXXXXXX")
                time.sleep(60)
                return 0
        else:
            log_string = "Reject this account \n=================== \nReason : \n   Is Selebgram : %s \n   Is Fake Account : %s \n   Is Active User : %s \n" % (
                self.is_selebgram, self.is_fake_account, self.is_active_user)
            self.write_log(log_string)
            self.is_rejected = True
            self.media_by_user = []
            self.media_on_feed = []
            return 0
Exemplo n.º 9
0
def get_media_id_user_feed(self):
    if self.login_status:
        if self.is_by_tag != True:
            log_string = "======> Get media id by user: %s <======" % (
                self.current_user)
            if self.is_checked != True:
                get_user_info(self, self.current_user)
            if self.is_fake_account != True and self.is_active_user != False and self.is_selebgram != True or self.is_by_tag != False:
                url = 'https://www.instagram.com/%s/?__a=1' % (self.current_user)
        else:
            log_string = "======> Get media id by Tag <======"
            url = 'https://www.instagram.com/explore/tags/%s/?__a=1' % (
                random.choice(self.tag_list))
        self.write_log(log_string)

        if self.login_status == 1 and self.is_fake_account != True and self.is_active_user != False and self.is_selebgram != True or self.is_by_tag != False:
            try:
                r = self.s.get(url)
                all_data = json.loads(r.text)

                if self.is_by_tag != True:
                    self.media_by_user = list(all_data['user']['media']['nodes'])
                else:
                    self.media_by_user = list(all_data['tag']['media']['nodes'])
                log_string = "Get media by user success!"
                self.write_log(log_string)
            except:
                self.media_by_user = []
                self.write_log("XXXXXXX Except on get_media! XXXXXXX")
                time.sleep(60)
                return 0
        else:
            log_string = "Reject this account \n=================== \nReason : \n   Is Selebgram : %s \n   Is Fake Account : %s \n   Is Active User : %s \n" % (
                self.is_selebgram, self.is_fake_account, self.is_active_user)
            self.write_log(log_string)
            self.is_rejected = True
            self.media_by_user = []
            self.media_on_feed = []
            return 0