Exemple #1
0
def main():
    config = ConfigManager()
    config.set_many(DEFAULT_CONFIG)
    _config = ConfigManager(schema=schema, defaults=defaults)
    config.set_many(_config.as_dict())
    config.set_many(ConfigManager(path=_config.get('config.file')).as_dict())
    config.set_many(_config.as_dict())
    config.commit()

    if config.get('dump_configuration'):
        conf = config.as_dict()
        conf.pop('config42')
        print(yaml.dump(conf))
        exit(0)
    if config.get('show_version'):
        print(instabot_py.__version__)
        exit(0)

    if config.get('verbosity'):
        verbosity = int(config.get('verbosity'))
        if verbosity == 1:
            level = logging.INFO
        elif verbosity > 1:
            level = logging.DEBUG
        config.set("logging.root.level", level)

    logging.config.dictConfig(config.get("logging"))
    bot = InstaBot(config=config)
    bot.mainloop()
Exemple #2
0
def main():
    config = ConfigManager()
    config.set_many(DEFAULT_CONFIG)
    _config = ConfigManager(schema=schema, defaults=defaults)
    config.set_many(_config.as_dict())
    config.set_many(
        ConfigManager(schema=schema,
                      path=_config.get('config.file')).as_dict())
    config.set_many(_config.as_dict())
    config.commit()

    if config.get('dump_configuration'):
        conf = config.as_dict()
        conf.pop('config42')
        print(yaml.dump(conf))
        exit(0)
    if config.get('show_version'):
        print("Installed version {}".format(instabot_py.__version__))
        exit(0)

    if not config.get('ignore_updates'):
        last_version = get_last_version()
        if last_version and last_version != instabot_py.__version__:
            print(
                "Newer version available: {}, The current version: {}".format(
                    last_version, instabot_py.__version__))
            print(
                "To update, please type \n python3 -m pip install instabot-py --upgrade --no-cache-dir "
            )
            print("")
            print(
                "  > You can ignore warning, run the instabot with --ignore-updates flag"
            )
            exit(0)

    if config.get('verbosity'):
        verbosity = int(config.get('verbosity'))
        if verbosity == 1:
            level = logging.INFO
        elif verbosity > 1:
            level = logging.DEBUG
        config.set("logging.root.level", level)

    logging.config.dictConfig(config.get("logging"))
    try:
        bot = InstaBot(config=config)
    except CredsMissing:
        print(
            "You didn't provide your Instagram login & password or you didn't specify the configuration file"
        )
        print("Try again :")
        print("")
        print("   instabot-py --login YOUR_LOGIN --password YOUR_PASSWORD")
        print("   instabot-py -c your-config.yml")
        print(
            "You can export and modify the default configuration by typing the command below"
        )
        print("    instabot-py --dump")
        exit(1)
    bot.mainloop()
Exemple #3
0
def main():
    if len(sys.argv) > 1:
        param = sys.argv[1].lower()
        if param == "--":
            configdict = {}
        else:
            configdict = interactive(param, loaded_with_argv=True)
    else:
        configdict = interactive()

    bot = InstaBot(**configdict)
    bot.mainloop()
Exemple #4
0
def main():
    print("The interactive mode is deprecated. Please use the declarative mode with YAML settings\n"
          "Please refer to Github README + (instabot -h) + Blog section for further information")
    _ = input("Press Enter to continue. ")

    if len(sys.argv) > 1:
        param = sys.argv[1].lower()
        configdict = interactive(param, loaded_with_argv=True)
    else:
        configdict = interactive()

    bot = InstaBot(**configdict)

    bot.mainloop()
Exemple #5
0
def main():
    config = ConfigManager()
    config.set_many(DEFAULT_CONFIG)
    _config = ConfigManager(schema=schema, defaults=defaults)
    config.set_many(_config.as_dict())
    config_file = _config.get('config.file')
    config.set_many(ConfigManager(schema=schema, path=config_file).as_dict())
    config.set_many(_config.as_dict())
    config.commit()

    configure_logging(config)
    if config.get('dump_configuration'):
        conf = config.as_dict()
        conf.pop('config42')
        conf.pop('dump_configuration')
        print(yaml.dump(conf))
        exit(0)

    if config.get('create_configuration'):
        create_configuration()
        exit(0)

    if config.get('show_version'):
        print("Installed version {}".format(instabot_py.__version__))
        exit(0)

    if not config.get('ignore_updates'):
        last_version = get_last_version()
        current_version = instabot_py.__version__
        if last_version and last_version != current_version:
            print(f"""Newer version is available: {last_version}. The current \
version is: {current_version}.
To update instabot-py, please perform: 
    python3 -m pip install instabot-py --upgrade --no-cache-dir
                
    > You can also ignore this warning and upgrade instabot-py later. In this \
case, please run the instabot with '--ignore-updates' flag.""")
            exit(0)

    if config_file:
        print(f"Reading configuration ({len(_config.as_dict())} settings) from"
              f" {config_file}")
    elif os.path.isfile('instabot.config.yml'):
        print("Using 'instabot.config.yml' as a configuration, add "
              "'-c your-config.yml' if you want to use your config file")
    else:
        print("Configuration file has not been found. Please run the instabot "
              "with '--create-config' flag.")
        exit(0)

    try:
        bot = InstaBot(config=config)
    except CredsMissing:
        print(
            """We could not find your Instagram login and/or password. Maybe \
you did not change the default ones in the config file.
You can specify them either directly, correct them in the default config file \
or use your own config file:

    instabot-py --login YOUR_LOGIN --password YOUR_PASSWORD    
or
    instabot-py -c your-config.yml
""")
        exit(1)

    bot.mainloop()
Exemple #6
0
    user_max_follow=0,
    # session_file=False, # Set to False to disable persistent session, or specify custom session_file (ie ='myusername.session')
    user_min_follow=0,
    log_mod=0,
    proxy="",
    # List of list of words, each of which will be used to generate comment
    # For example: "This shot feels wow!"
    comment_list=[
        ["ممنون", "متشکریم"],
        ["پیجتون", "صفحتون"],
        ["واقعا", "حقیقتا", "خیلی"],
        ["عالیهه","عالیه",],
        ["👌ممنون میشم پیج ماهم دنبال کنید","🙏ممنون میشم پیج ماهم دنبال کنید","👍ممنون میشم پیج ماهم دنبال کنید"],
    ],
    # 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=[
        "second",
        "stuff",
    ],
    unfollow_whitelist=["example_user_1", "example_user_2"],
    # Enable the following to schedule the bot. Uses 24H
    # end_at_h = 23, # Hour you want the bot to stop
    # end_at_m = 30, # Minute you want the bot stop, in this example 23:30
    # start_at_h = 9, # Hour you want the bot to start
    # start_at_m = 10, # Minute you want the bot to start, in this example 9:10 (am).
)

bot.mainloop()
def main():
    config = ConfigManager()
    config.set_many(DEFAULT_CONFIG)
    _config = ConfigManager(schema=schema, defaults=defaults)
    config.set_many(_config.as_dict())
    config_file = _config.get('config.file')
    config.set_many(ConfigManager(schema=schema, path=config_file).as_dict())
    config.set_many(_config.as_dict())
    config.commit()

    configure_logging(config)
    if config.get('dump_configuration'):
        conf = config.as_dict()
        conf.pop('config42')
        conf.pop('dump_configuration')
        print(yaml.dump(conf))
        exit(0)
    if config.get('show_version'):
        print("Installed version {}".format(instabot_py.__version__))
        exit(0)

    if not config.get('ignore_updates'):
        last_version = get_last_version()
        if last_version and LooseVersion(last_version) > LooseVersion(
                instabot_py.__version__):
            print(
                "Newer version available: {}, The current version: {}".format(
                    last_version, instabot_py.__version__))
            print(
                "To update, please type \n python3 -m pip install instabot-py --upgrade --no-cache-dir "
            )
            print("")
            print(
                "  > You can ignore warning, run the instabot with --ignore-updates flag"
            )
            exit(0)

    try:
        bot = InstaBot(config=config)
        if config_file:
            bot.logger.info(
                f"Reading configuration ({len(_config.as_dict())} settings) from {config_file}"
            )
        else:
            bot.logger.info(
                f"Use the default configuration, add '-c your-config.yml' to specify your config"
            )

    except CredsMissing:
        print(
            "You didn't provide your Instagram login & password or you didn't specify the configuration file"
        )
        print("Try again :")
        print("")
        print("   instabot-py --login YOUR_LOGIN --password YOUR_PASSWORD")
        print("   instabot-py -c your-config.yml")
        print(
            "You can export and modify the default configuration by typing the command below"
        )
        print("    instabot-py --dump")
        exit(1)
    bot.mainloop()
Exemple #8
0
def start_bot():

    bot = InstaBot(
        login=entry_1.get(),  # Enter username (lowercase). Do not enter email!
        password=entry_2.get(),
        like_per_day=int(entry_3.get()),
        comments_per_day=int(entry_4.get()),
        tag_list=[entry_5.get(),
                  entry_6.get(),
                  entry_7.get(),
                  entry_8.get()],
        tag_blacklist=["rain", "thunderstorm"],
        user_blacklist={},
        max_like_for_one_tag=50,
        follow_per_day=int(entry_9.get()),
        follow_time=1 * 60 * 60,
        unfollow_per_day=int(entry_x.get()),
        unlike_per_day=0,
        unfollow_recent_feed=True,
        # If True, the bot will also unfollow people who dont follow you using the recent feed. Default: True
        time_till_unlike=3 * 24 * 60 * 60,  # 3 days
        unfollow_break_min=15,
        unfollow_break_max=30,
        user_max_follow=0,
        # session_file=False, # Set to False to disable persistent session, or specify custom session_file (ie ='myusername.session')
        user_min_follow=0,
        log_mod=0,
        proxy="",
        # 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"],
            ["is", "looks", "is 👉", "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=[
            "second",
            "stuff",
            "art",
            "project",
            "love",
            "life",
            "food",
            "blog",
            "free",
            "keren",
            "photo",
            "graphy",
            "indo",
            "travel",
            "art",
            "shop",
            "store",
            "sex",
            "toko",
            "jual",
            "online",
            "murah",
            "jam",
            "kaos",
            "case",
            "baju",
            "fashion",
            "corp",
            "tas",
            "butik",
            "grosir",
            "karpet",
            "sosis",
            "salon",
            "skin",
            "care",
            "cloth",
            "tech",
            "rental",
            "kamera",
            "beauty",
            "express",
            "kredit",
            "collection",
            "impor",
            "preloved",
            "follow",
            "follower",
            "gain",
            ".id",
            "_id",
            "bags",
        ],
        unfollow_whitelist=["example_user_1", "example_user_2"],
        # Enable the following to schedule the bot. Uses 24H
        # end_at_h = 23, # Hour you want the bot to stop
        # end_at_m = 30, # Minute you want the bot stop, in this example 23:30
        # start_at_h = 9, # Hour you want the bot to start
        # start_at_m = 10, # Minute you want the bot to start, in this example 9:10 (am).
    )

    bot.mainloop()
def run_the_bot(arguments):
    username = arguments['username'][0]
    passkey = arguments['passkey'][0]
    hashtags = str(arguments['hashtags'][0]).split(',')
    target_nickname = arguments['target_nickname'][0]

    bot = InstaBot(
        login=username,  # Enter username (lowercase). Do not enter email!
        password=passkey,
        like_per_day=1000,
        comments_per_day=0,
        tag_list=hashtags,
        tag_blacklist=["rain", "thunderstorm"],
        user_blacklist={},
        max_like_for_one_tag=50,
        follow_per_day=300,
        follow_time=1 * 60 * 60,
        unfollow_per_day=300,
        unlike_per_day=0,
        unfollow_recent_feed=True,
        # If True, the bot will also unfollow people who dont follow you using the recent feed. Default: True
        time_till_unlike=3 * 24 * 60 * 60,  # 3 days
        unfollow_break_min=15,
        unfollow_break_max=30,
        user_max_follow=0,
        # session_file=False, # Set to False to disable persistent session, or specify custom session_file (ie ='myusername.session')
        user_min_follow=0,
        log_mod=0,
        proxy="",
        # List of list of words, each of which will be used to generate comment
        # For example: "This shot feels wow!"
        comment_list=[
            [
                "Semoga sehat selalu ya {} 😍".format(target_nickname),
                "Halo {}... Lucu banget dehh! 😍".format(target_nickname),
                "Halo {}. Semoga sehat terus ya sekeluarga! 😍".format(
                    target_nickname)
            ],
            [
                "Sudah coba minyak kutus kutus?",
                "Kami punya minyak kutus kutus lhoo!"
            ],
            [
                "Bagus banget buat si kecil kalo lagi flu atau demam",
                "Khasiatnya banyak banget lhoo, bisa buat berbagai macam penyakit juga!",
                "Bisa buat pegel-pegel, gangguan syaraf, bahkan buat vitalitas!"
            ],
            [
                "Btw, kita lagi ada promo gratis ongkir lho, mampir yuk cek ig kita ya"
            ],
            [".", "🙌", "... 👏", "!", "! 😍", "😎"],
        ],
        # 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=[
            "second",
            "stuff",
            "art",
            "project",
            "love",
            "life",
            "food",
            "blog",
            "free",
            "keren",
            "photo",
            "graphy",
            "indo",
            "travel",
            "art",
            "shop",
            "store",
            "sex",
            "toko",
            "jual",
            "online",
            "murah",
            "jam",
            "kaos",
            "case",
            "baju",
            "fashion",
            "corp",
            "tas",
            "butik",
            "grosir",
            "karpet",
            "sosis",
            "salon",
            "skin",
            "care",
            "cloth",
            "tech",
            "rental",
            "kamera",
            "beauty",
            "express",
            "kredit",
            "collection",
            "impor",
            "preloved",
            "follow",
            "follower",
            "gain",
            ".id",
            "_id",
            "bags",
        ],
        unfollow_whitelist=["arizhopratama", "portalmiliarder"],
        # Enable the following to schedule the bot. Uses 24H
        # end_at_h = 23, # Hour you want the bot to stop
        # end_at_m = 30, # Minute you want the bot stop, in this example 23:30
        # start_at_h = 9, # Hour you want the bot to start
        # start_at_m = 10, # Minute you want the bot to start, in this example 9:10 (am).
    )

    bot.mainloop()