Beispiel #1
0
    follovers_followings = []

    follovers_followings.extend(mas_followers)
    follovers_followings.extend(mas_followings)

    print('Генерация массива пользователей')

    #users_f = []

    i = 1  #сквозной счетчик итераций
    s_podpiska = 1  #счетчик подписок
    s_otpiska = 1  #счетчик отписок

    for following in follovers_followings:
        pk = following['pk']
        data_follow = api.friendships_show(pk)

        #Я подписан, а на меня не подписаны
        if data_follow['following'] == True and data_follow[
                'followed_by'] == False:
            print('Пользователь: ' + following['username'])
            print(
                'Подписка невзаимная с его строны - отписка от пользователя(' +
                str(s_otpiska) + ')')
            try:
                api.friendships_destroy(pk)
                s_otpiska += 1
                t = randint(config.START_SLEEP_TIME_TO_UNFOLLOW,
                            config.FINISH_SLEEP_TIME_TO_UNFOLLOW)
                print('Жди ' + str(t) + ' сек')
                print()
Beispiel #2
0
class InstagramManager(object):
    def __init__(self):
        self.username = config_reader.ConfigHelper.read_config(
            'account', 'username')
        self.password = config_reader.ConfigHelper.read_config(
            'account', 'password')
        self.api = Client(self.username, self.password)
        self.follower_list = []
        self.story_user_list = []
        self.daily_follow_num = int(
            config_reader.ConfigHelper.read_config('setting',
                                                   'daily_follow_num'))
        self.comment_list = config_reader.ConfigHelper.get_comments()
        self.tag_feeds = []
        self.tag_hot_feeds = []

    def re_login(self):
        self.api = Client(self.username, self.password)

    def start_work(self):
        self.deal_account()
        #self.api.current_user();
        #self.deal_unfollow()
        #self.deal_tag()
        #self.deal_story()
        #self.deal_comment_and_like()

    def deal_account(self):
        username = config_reader.ConfigHelper.read_config(
            'setting', 'focus_account')
        user_id = self.get_user_id(username)
        if user_id is None:
            print('no this user')
        else:
            page_num = config_reader.ConfigHelper.read_config(
                'page', 'page_num')
            self.get_follower(user_id, page_num)
        for follower in self.follower_list:
            pk = follower.get('pk')
            name = follower.get('username')
            self.api.friendships_create(pk)
            database_helper.DatabaseHelper.insert_follower(pk, name)
            config_reader.ConfigHelper.write_config('follower', str(pk), name,
                                                    'daily_result.ini')

    def deal_unfollow(self):
        followers = database_helper.DatabaseHelper.select_follower()
        for follower in followers:
            follow_timestamp = follower.timestamp
            timestamp = time.time()
            # 根据配置天数自动取关
            day = int(
                config_reader.ConfigHelper.read_config('setting',
                                                       'unfollow_days'))
            time_diff = day * 24 * 60 * 60
            if timestamp - follow_timestamp >= time_diff:
                if self.has_real_followed(follower.user_id, follower.username):
                    print('start_friendships_destroy:' + follower.username)
                    self.api.friendships_destroy(follower.user_id)
                    database_unfollower_helper.DatabaseUnFollowHelper.insert_data(
                        follower.user_id, follower.username)
                    print('friendships_destroy:' + follower.username)

    def deal_comment_and_like(self):
        for follower in self.follower_list:
            pk = follower.get('pk')
            name = follower.get('username')
            print('comment:' + name)
            is_private = follower.get('is_private')
            if not is_private:
                feeds = self.get_user_feed(pk)
                for feed in feeds:
                    media_id = feed.get('pk')
                    self.comment_feed(media_id)
                    self.like_feed(media_id)
                print(name + ' comment and like success')
            else:
                print(name + 'is a private account')

    def deal_tag(self, max_id=None):
        tag = config_reader.ConfigHelper.read_config('setting', 'focus_tag')
        if max_id is None:
            feed_tag = self.api.feed_tag(tag)
        else:
            feed_tag = self.api.feed_tag(tag, max_id=max_id)
        next_max_id = feed_tag.get('next_max_id')
        if next_max_id:
            self.deal_tag(next_max_id)
            return
        self.set_feeds(feed_tag)
        self.set_hot_feeds(feed_tag)
        for feed in self.tag_feeds:
            media_id = feed.get('pk')
            self.comment_feed(media_id)
        for hot_feed in self.tag_hot_feeds:
            media_id = hot_feed.get('pk')
            self.comment_feed(media_id)

    def get_user_id(self, username):
        results = self.api.search_users(username)
        users = []
        users.extend(results.get('users', []))
        for user in users:
            if user.get('username') == username:
                pk = user.get('pk')
                return pk
        return None

    def get_follower(self, user_id, max_id=None):
        if max_id is None:
            user_followers = self.api.user_followers(user_id)
        else:
            user_followers = self.api.user_followers(user_id, max_id=max_id)
        users = []
        users.extend(user_followers.get('users', []))
        for user in users:
            pk = user.get('pk')
            username = user.get('username')
            is_meet = (not self.has_followed(pk)
                       ) and self.is_meet_requirements(pk, username)
            if is_meet:
                self.follower_list.append(user)
                # 取到了每天需要follow数量即可停止
                if len(self.follower_list) >= self.daily_follow_num:
                    return
        next_max_id = user_followers.get('next_max_id')
        config_reader.ConfigHelper.write_config('page', 'page_num',
                                                next_max_id)
        if next_max_id:
            self.get_follower(user_id, next_max_id)

    # 是否满足我们follow的要求
    def is_meet_requirements(self, user_id, username):
        if database_meet_helper.DatabaseMeetHelper.is_un_meet(user_id):
            print('DatabaseMeetHelper un_meet')
            return False
        post_meet_num = int(
            config_reader.ConfigHelper.read_config('follower_request', 'post'))
        follower_meet_num = int(
            config_reader.ConfigHelper.read_config('follower_request',
                                                   'followers'))
        following_meet_num = int(
            config_reader.ConfigHelper.read_config('follower_request',
                                                   'following'))
        user_info = self.api.user_info(user_id).get('user')
        post_num = user_info.get('media_count')
        follower_count = user_info.get('follower_count')
        following_count = user_info.get('following_count')
        is_meet = (post_num >= post_meet_num
                   and follower_count >= follower_meet_num
                   and following_count >= following_meet_num)
        print(str(user_id) + ":" + str(is_meet))
        if not is_meet:
            database_meet_helper.DatabaseMeetHelper.insert_data(
                user_id, username)
        return is_meet

    # 判断是否关注过,包括已经关注、发送过关注请求(私人账户)、已经关注过(可能现在已经取关)
    def has_followed(self, user_id):
        friendships_show = self.api.friendships_show(user_id)
        is_following = friendships_show.get('following')
        outgoing_request = friendships_show.get('outgoing_request')
        database_is_followed = database_helper.DatabaseHelper.is_followed(
            user_id)
        return is_following or outgoing_request or database_is_followed

    # 判断是正在关注的,用于取关的时候用到,只有在ins中关注的才需要取关
    def has_real_followed(self, user_id, user_name):
        # 如果在去粉的数据库中,则说明已经被去粉,就不再去调用ins接口,否则很容易被限制
        if database_unfollower_helper.DatabaseUnFollowHelper.is_in_data(
                user_id):
            return False
        try:
            friendships_show = self.api.friendships_show(user_id)
            is_following = friendships_show.get('following')
            outgoing_request = friendships_show.get('outgoing_request')
            return is_following or outgoing_request
        except ClientError as e:
            print('has_real_followed ClientError')
            return False

    def set_feeds(self, feed_tag):
        feeds = feed_tag.get('items')
        daily_recent_posts = config_reader.ConfigHelper.read_config(
            'setting', 'daily_recent_posts')
        tag_feed_request_like = config_reader.ConfigHelper.read_config(
            'setting', 'tag_feed_request_like')
        for feed in feeds:
            media_id = feed.get('pk')
            media_info = self.api.media_info(media_id)
            item = media_info.get('items')[0]
            like_count = item.get('like_count')
            if like_count > int(tag_feed_request_like):
                self.tag_feeds.append(feed)
            if len(self.tag_feeds) >= int(daily_recent_posts):
                break

    def set_hot_feeds(self, feed_tag):
        hot_feeds = feed_tag.get('ranked_items')
        daily_top_posts = config_reader.ConfigHelper.read_config(
            'setting', 'daily_top_posts')
        for hot_feed in hot_feeds:
            self.tag_hot_feeds.append(hot_feed)
            if len(self.tag_hot_feeds) >= int(daily_top_posts):
                break

    # 获取某个用户的post(数量根据配置)
    def get_user_feed(self, user_id):
        user_feed = self.api.user_feed(user_id)
        feeds = user_feed.get('items')
        num = int(
            config_reader.ConfigHelper.read_config('follower_request',
                                                   'post_num_for_comment'))
        return feeds[:int(num)]

    # 对post进行评论
    def comment_feed(self, media_id):
        length = len(self.comment_list)
        x = random.randint(0, length - 1)
        comment = self.comment_list[x]
        print('start comment,media_id:' + str(media_id) + "——" + comment)
        try:
            self.api.post_comment(media_id, str(comment))
            print('comment:' + comment + ' success')
        except Exception as e:
            print('comment:' + comment + ' error:' + str(e))

    # 对post进行like
    def like_feed(self, media_id):
        self.api.post_like(media_id)

    def deal_story(self):
        self.get_user_story()

    def get_user_story(self):
        reels_tray = self.api.reels_tray()
        broadcasts = reels_tray.get('broadcasts')
        tray = reels_tray.get('tray')
        for item in tray:
            user = item.get('user')
            name = user.get('username')
            user_detail_info = self.api.user_detail_info(
                user.get('pk')).get('user_detail').get('user')
            post_num = user_detail_info.get('media_count')
            follower_count = user_detail_info.get('follower_count')
            following_count = user_detail_info.get('following_count')
            post_meet_num = int(
                config_reader.ConfigHelper.read_config('story_request',
                                                       'post'))
            follower_meet_num = int(
                config_reader.ConfigHelper.read_config('story_request',
                                                       'followers'))
            following_meet_num = int(
                config_reader.ConfigHelper.read_config('story_request',
                                                       'following'))
            daily_story_comment_num = int(
                config_reader.ConfigHelper.read_config('setting',
                                                       'daily_story_comment'))
            is_meet = (post_num >= post_meet_num
                       and follower_count >= follower_meet_num
                       and following_count <= following_meet_num)
            if is_meet:
                stories = item.get('items')
                if stories is None:
                    continue
                for story in stories:
                    length = len(self.comment_list)
                    x = random.randint(0, length)
                    comment = self.comment_list[x]
                    self.api.broadcast_comment(story.get('pk'), comment)
                    print(name + 'story comment:' + comment + "success")
                self.story_user_list.append(item)
            if len(self.story_user_list) >= daily_story_comment_num:
                break
def main():
    logo = f"""
    {Style.BRIGHT + Fore.RED}  ▄▄ ▄███▄{Style.RESET_ALL}
    {Style.BRIGHT + Fore.RED}▄▀▀▀▀ ▄▄▄ ▀▀▀▀▄   {Style.BRIGHT + Fore.MAGENTA}Instagram Kitleye Göre Takipçi Bulucu{Style.RESET_ALL}
    {Style.BRIGHT + Fore.RED}█    █   █    █   {Style.BRIGHT + Fore.RED}+-----------------------------------+{Style.RESET_ALL}
    {Style.BRIGHT + Fore.RED}█    ▀▄▄▄▀    █             {Style.BRIGHT + Fore.YELLOW}HACKED BY GODEST{Style.RESET_ALL}
    {Style.BRIGHT + Fore.RED}▀▄▄▄▄▄▄▄▄▄▄▄▄▄▀{Style.RESET_ALL}

    """
    print(logo)
    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Hangi takip etme yöntemini kullanmak istersiniz:{Style.RESET_ALL}")
    tmp = (11 * " ")
    print(f"{Style.RESET_ALL}{tmp}{Style.BRIGHT + Fore.MAGENTA}1 > {Style.RESET_ALL + Fore.WHITE}Hastag kullanarak takipçi bulma.{Style.RESET_ALL}")
    print(f"{Style.RESET_ALL}{tmp}{Style.BRIGHT + Fore.MAGENTA}2 > {Style.RESET_ALL + Fore.WHITE}Kullanıcıdan takipçi bulma.{Style.RESET_ALL}")
    print(f"{Style.RESET_ALL}")
    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[>] {Style.BRIGHT + Fore.WHITE}Seçiminiz:{Style.RESET_ALL} ", end="")
    method = input()

    if (method != "1" and method != "2"):
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Seçiminiz 1 veya 2 olmalıdır!{Style.RESET_ALL}")
        exit(0)
    
    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Ardaşık takipler sırasında kaç saniye beklensin: {Style.RESET_ALL}", end="")
    sleep_sec = input()
        
    try:
        int(sleep_sec)
    except:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Bekleme süresi bir sayı olmalıdır!{Style.RESET_ALL}")
        exit(0)

    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Kullanıcı adınız: {Style.RESET_ALL}", end="")
    username = input()
    if (" " in username or username.strip() == ""):
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Kullanıcı adınız boş veya boşluk içeriyor!{Style.RESET_ALL}")
        exit(0)
    
    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Şifreniz: {Style.RESET_ALL}", end="")
    password = input()

    if (password.strip() == ""):
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Şifreniz boş olamaz!{Style.RESET_ALL}")
        exit(0)

    try:
        api = Client(username, password)
    except errors.ClientLoginError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Kullanıcı adınız veya şifreniz hatalı! ({e}){Style.RESET_ALL}")
        exit(0)
    except errors.ClientChallengeRequiredError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Giriş için doğrulama gerekli! ({e}){Style.RESET_ALL}")
        exit(0)
    except errors.ClientCheckpointRequiredError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Giriş için doğrulama gerekli! ({e}){Style.RESET_ALL}")
        exit(0)
    except errors.ClientSentryBlockError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Giriş yapılamadı! Hesap spam olarak işaretlenmiş! ({e}){Style.RESET_ALL}")
        exit(0)
    except errors.ClientConnectionError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Bağlantı hatası! ({e}){Style.RESET_ALL}")
        exit(0)
    except errors.ClientError as e:
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Giriş yapılamadı! ({e}){Style.RESET_ALL}")
        exit(0)
    
    print("")
    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}Giriş yapıldı!{Style.RESET_ALL}")
    
    if ("R35" not in logo):
        print("Bu Programı Godest'ten Çaldım O Kadar Malım'ki Bunu Kaldırmayı Unuttum.")
        exit(0)

    if (method == "1"):
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Aramak istediğiniz hastagleri giriniz ('#' siz ve hastagler arası virgül koyunuz):{Style.RESET_ALL} ", end="")
        hashtags = input()
        hashtag_list = hashtags.strip().split(",")
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{len(hashtag_list)} adet hastag aranacak!{Style.RESET_ALL}")
        
        for hashtag in hashtag_list:
            if (hashtag.strip() == ""):
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Boş hashtag bulundu! Geçiliyor.{Style.RESET_ALL}")
                continue

            try:
                data = api.top_search(hashtag)

                if (len(data["users"]) == 0):
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{hashtag} hashtagini kimse kullanmamış! Geçiliyor!{Style.RESET_ALL}")
                    continue
                
                tmp = len(data["users"])
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} adet kullanıcıya takip atılacak!{Style.RESET_ALL}")

                for users in data["users"]:
                    if ("user" not in users):
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Kullanıcı bulunamadı! Geçiliyor.{Style.RESET_ALL}")
                        continue

                    user_data = users["user"]
                    tmp = user_data["username"]

                    try:
                        if(api.friendships_show(user_data["pk"])["following"] == True):
                            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına zaten takip atıldı! Geçildi!{Style.RESET_ALL}")
                            continue

                        api.friendships_create(user_data["pk"])
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atıldı!{Style.RESET_ALL}")
                    except errors.ClientError as e:
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! ({e}){Style.RESET_ALL}")
                    except errors.ClientConnectionError as e:
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! Bağlantı hatası!({e}){Style.RESET_ALL}")
                    
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.CYAN}[*] {Style.BRIGHT + Fore.WHITE}{sleep_sec} saniye bekleniyor!{Style.RESET_ALL}")
                    sleep(int(sleep_sec))
                    continue
            except errors.ClientError as e:
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Hashtag bilgileri alınamadı! ({e}){Style.RESET_ALL}")
            except errors.ClientConnectionError as e:
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Bağlantı hatası! ({e}){Style.RESET_ALL}")
    elif (method == "2"):
        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.MAGENTA}[?] {Style.BRIGHT + Fore.WHITE}Hedefin kullanıcı adını girin:{Style.RESET_ALL} ", end="")
        target_username = input()
        if (" " in target_username or target_username.strip() == ""):
            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Hedefin kullanıcı adı boş veya boşluk içeriyor!{Style.RESET_ALL}")
            exit(0)

        try:
            data = api.username_info(target_username)
            data = api.user_followers(data["user"]["pk"], api.generate_uuid())
            
            tmp = data["users"]
            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{len(tmp)} adet kullanıcıya takip atılacak!{Style.RESET_ALL}")

            for user in data["users"]:
                try:
                    tmp = user["username"]

                    if(api.friendships_show(str(user["pk"]))["following"] == True):
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına zaten takip atıldı! Geçildi!{Style.RESET_ALL}")
                        continue

                    api.friendships_create(str(user["pk"]))
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atıldı!{Style.RESET_ALL}")
                except errors.ClientError as e:
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! ({e}){Style.RESET_ALL}")
                except errors.ClientConnectionError as e:
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! Bağlantı hatası!({e}){Style.RESET_ALL}")
                    
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.CYAN}[*] {Style.BRIGHT + Fore.WHITE}{sleep_sec} saniye bekleniyor!{Style.RESET_ALL}")
                sleep(int(sleep_sec))
                continue
                    
        except errors.ClientError as e:
            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Hashtag bilgileri alınamadı! ({e}){Style.RESET_ALL}")
        except errors.ClientConnectionError as e:
            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Bağlantı hatası! ({e}){Style.RESET_ALL}")

    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.CYAN}[*] {Style.BRIGHT + Fore.WHITE}Takip işlemleri bitti!{Style.RESET_ALL}")
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{hashtag} hashtagini kimse kullanmamış! Geçiliyor!{Style.RESET_ALL}")
                    continue
                
                tmp = len(data["users"])
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} adet kullanıcıya takip atılacak!{Style.RESET_ALL}")

                for users in data["users"]:
                    if ("user" not in users):
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Kullanıcı bulunamadı! Geçiliyor.{Style.RESET_ALL}")
                        continue

                    user_data = users["user"]
                    tmp = user_data["username"]

                    try:
                        if(api.friendships_show(user_data["pk"])["following"] == True):
                            print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına zaten takip atıldı! Geçildi!{Style.RESET_ALL}")
                            continue

                        api.friendships_create(user_data["pk"])
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.GREEN}[+] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atıldı!{Style.RESET_ALL}")
                    except errors.ClientError as e:
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! ({e}){Style.RESET_ALL}")
                    except errors.ClientConnectionError as e:
                        print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}{tmp} kullanıcısına takip atılamadı! Bağlantı hatası!({e}){Style.RESET_ALL}")
                    
                    print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.CYAN}[*] {Style.BRIGHT + Fore.WHITE}{sleep_sec} saniye bekleniyor!{Style.RESET_ALL}")
                    sleep(int(sleep_sec))
                    continue
            except errors.ClientError as e:
                print(f"{Style.RESET_ALL}{get_time()} {Style.BRIGHT + Fore.RED}[-] {Style.BRIGHT + Fore.WHITE}Hashtag bilgileri alınamadı! ({e}){Style.RESET_ALL}")
Beispiel #5
0
    #сквозной счетчик добавлений в друзья
    sf = 1
    for user in my_following:
        if user['username'] in target_list:
            print('****************************************************************')
            print('Пользователь ' + user['username'] + ' найден')
            pk = user['pk']
            target_followers = api.user_followers(pk, rank_tok)
            i=1
            like_posts = []
            #идем по каждому фолловеру
            for tg_follower in target_followers['users']:
                print('\tБерем его друга: ' + tg_follower['username'])
                if tg_follower['is_private'] == False:
                    #print(tg_follower)
                    data_follow = api.friendships_show(tg_follower['pk'])
                    #print(data_follow)
                    #Я на него не подписан
                    if data_follow['following'] == False:
                        print('\t\tОн не в друзьях, подписка')

                        #подписываемся
                        friend = api.friendships_create(tg_follower['pk'])

                        cnt_feed=randint(2, 3)
                        #print('Пролайкаем ' + str(cnt_feed) + 'поста')
                        feed_user = api.user_feed(tg_follower['pk'])
                        f=1
                        sum_time = 0
                        #идем по каждому посту в ленте пользователя
                        for feed in feed_user['items']:
Beispiel #6
0
        print_banner()
        print_stats()
        print('🎲' * x)
        console.set_color(1, 0, 0)
        print('-' * 14)
        console.set_color(1, 1, 1)

        console.set_font("Menlo-Bold", 15)
        print('@{0}({1}):'.format(comment['user']['username'],
                                  comment['user']['full_name']))
        console.set_font()
        print(comment['text'])
        time.sleep(0.4 + (x**2) / 20)
        x += 1

    print()

    like = comment['user']['username'] in post_likers
    subscribe = api.friendships_show(comment['user_id'])['followed_by']

    print("Лайк:{}, Подписка:{}".format("✅" if like else "❌",
                                        "✅" if subscribe else "❌"))
    console.set_font("Menlo-Bold", 20)
    if like and subscribe:
        print("🎉" * 10)
        break
    else:
        print("😢" * 10)
        time.sleep(3)
    console.set_font()