def insta_bot_start(task):

    #task: task_id, date_start, date_end, subscribers_start, subscribers_end, new_task, login, password, tags, user_id, account_id, type_id, user_id
    try:
        bot = InstaBot(
            login="******",
            password="******",
            user_id_take='7134637717',
            #user_id_take='2233349262',
            like_per_day=1000,
            comments_per_day=0,
            tag_list=[
                'краснаяполяна', 'газпромлаура', 'сочи', 'совариум', 'sochi',
                'krasnaypolyna', 'sovarium', 'фотографсочи'
            ],
            tag_blacklist=[],
            user_blacklist={},
            max_like_for_one_tag=50,
            follow_per_day=300,
            follow_time=24 * 60 + 1,
            unfollow_per_day=300,
            unfollow_break_min=15,
            unfollow_break_max=30,
            log_mod=0,
            #proxy='',
            proxy='d0394ffe96:[email protected]:52593',
            # List of list of words, each of which will be used to generate comment
            # For example: "This shot feels wow!"
            comment_list=[["this", "the", "your"],
                          ["photo", "picture", "pic", "shot", "snapshot"],
                          ["is", "looks", "feels", "is really"],
                          [
                              "great", "super", "good", "very good", "good",
                              "wow", "WOW", "cool", "GREAT", "magnificent",
                              "magical", "very cool", "stylish", "beautiful",
                              "so beautiful", "so stylish", "so professional",
                              "lovely", "so lovely", "very lovely", "glorious",
                              "so glorious", "very glorious", "adorable",
                              "excellent", "amazing"
                          ], [".", "..", "...", "!", "!!", "!!!"]],
            # Use unwanted_username_list to block usernames containing a string
            ## Will do partial matches; i.e. 'mozart' will block 'legend_mozart'
            ### 'free_followers' will be blocked because it contains 'free'
            unwanted_username_list=[],
            unfollow_whitelist=[])
        while True:
            bot.new_auto_mod()
    except:
        error_task = task[:]
        error_task[5] = 3
        error_task[12] = 'cant run intagrambot example'
        # if error_task[1] != 'None':
        #     error_task[1] = datetime.fromtimestamp(int(arg_task[1].timestamp()))
        # if error_task[2] != 'None':
        #     error_task[2] = datetime.fromtimestamp(int(arg_task[2].timestamp()))
        sql_works.return_statictic_to_front(error_task, 0)
示例#2
0
if __name__ == "__main__":

    #only active instagram tasks from frontend
    #return: task_id, account_id, type_id, tags, user_id, login, password
    insta_front_tasks = sql_works.get_tasks_front()

    #returns: task_id, user_id, account_id, type_id, date_start, subscribers_now, error_message, login, password, tags
    insta_tasks = post_processing(insta_front_tasks)
    #insta_tasks = post_processing(insta_front_tasks,1)

    #check not started tasks
    #returns:  task_id, date_start, date_end, subscribers_start, subscribers_end, new_task, login, password, tags, user_id, account_id, type_id, error_text, user_id
    insta_backend_tasks = sql_works.task_manager(insta_tasks)

    sql_works.return_statictic_to_front(insta_backend_tasks)

    #threads = []
    #with ThreadPoolExecutor(max_workers=2) as executor:
    count_bot_examples = 0
    for task in insta_backend_tasks:
        #new and restart
        if task[5] == 0 or task[5] == 1:
            if count_bot_examples < 4:
                count_bot_examples = count_bot_examples + 1
            #executor.submit(insta_bot_start, task)
                insta_bot_start(task)
            #t = threading.Thread(target=insta_bot_start, args=(task,))
            #threads.append(t)
            #t.start()