From f3d61edd3f71f328c52b49ded0467d98debfff2b Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Fri, 6 Aug 2021 11:54:53 +0200 Subject: [PATCH 1/9] perf: moving sibling folders of run.py will no longer executed automatically --- GramAddict/core/bot_flow.py | 3 ++- GramAddict/plugins/core_arguments.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/GramAddict/core/bot_flow.py b/GramAddict/core/bot_flow.py index d8ee45f6..501ba969 100644 --- a/GramAddict/core/bot_flow.py +++ b/GramAddict/core/bot_flow.py @@ -67,7 +67,8 @@ def start_bot(): check_if_updated() # Move username folders to a main directory -> accounts - move_usernames_to_accounts() + if "--move-folders-in-accounts" in configs.args: + move_usernames_to_accounts() # Global Variables sessions = PersistentList("sessions", SessionStateEncoder) diff --git a/GramAddict/plugins/core_arguments.py b/GramAddict/plugins/core_arguments.py index 72f8706a..af9abaff 100644 --- a/GramAddict/plugins/core_arguments.py +++ b/GramAddict/plugins/core_arguments.py @@ -202,7 +202,7 @@ def __init__(self): }, { "arg": "--close-apps", - "help": "close all apps except IG, for avoid interference", + "help": "close all apps except IG, to avoid interference", "action": "store_true", }, { @@ -346,4 +346,9 @@ def __init__(self): "default": None, "type": "str", }, + { + "arg": "--move-folders-in-accounts", + "help": "allow the script to move all the sibling folders of run.py in accounts folder", + "action": "store_true", + }, ] From 0eb3579406590e663935bcbeaa49245292d57bea Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 10:39:23 +0200 Subject: [PATCH 2/9] feat: new filter for skipping accounts with banned biography language new filter in filters,yml -> biography_banned_language: [en, it, 'no'] --- GramAddict/core/filter.py | 27 ++++++++++++++++++++++++--- config-examples/filters.yml | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/GramAddict/core/filter.py b/GramAddict/core/filter.py index 2032a160..76cd6735 100644 --- a/GramAddict/core/filter.py +++ b/GramAddict/core/filter.py @@ -40,6 +40,7 @@ FIELD_MANDATORY_WORDS = "mandatory_words" FIELD_SPECIFIC_ALPHABET = "specific_alphabet" FIELD_BIO_LANGUAGE = "biography_language" +FIELD_BIO_BANNED_LANGUAGE = "biography_banned_language" FIELD_MIN_POSTS = "min_posts" FIELD_MIN_LIKERS = "min_likers" FIELD_MAX_LIKERS = "max_likers" @@ -205,6 +206,7 @@ def check_profile(self, device, username): ) field_specific_alphabet = self.conditions.get(FIELD_SPECIFIC_ALPHABET) field_bio_language = self.conditions.get(FIELD_BIO_LANGUAGE) + field_bio_banned_language = self.conditions.get(FIELD_BIO_BANNED_LANGUAGE) field_min_posts = self.conditions.get(FIELD_MIN_POSTS) field_mutual_friends = self.conditions.get(FIELD_MUTUAL_FRIENDS, -1) field_skip_if_link_in_bio = self.conditions.get( @@ -393,6 +395,7 @@ def check_profile(self, device, username): or len(field_mandatory_words) > 0 or field_specific_alphabet is not None or field_bio_language is not None + or field_bio_banned_language is not None ) and cleaned_biography != "": logger.debug("Pulling biography...") if len(field_blacklist_words) > 0: @@ -444,14 +447,32 @@ def check_profile(self, device, username): return profile_data, self.return_check_profile( username, profile_data, SkipReason.ALPHABET_NOT_MATCH ) - if field_bio_language is not None: + if field_bio_language is not None or field_bio_banned_language is not None: + skip_1 = skip_2 = False logger.debug("Checking main language of account biography...") language = self._find_language(cleaned_biography) - if language not in field_bio_language and language != "": + if ( + field_bio_banned_language + and language in field_bio_banned_language + and language != "" + ): + logger.info( + f"@{username}'s biography language is in the banned list: {', '.join(field_bio_banned_language)}. ({language}), skip.", + extra={"color": f"{Fore.CYAN}"}, + ) + skip_1 = True + if ( + not skip_1 + and field_bio_language + and language not in field_bio_language + and language != "" + ): logger.info( - f"@{username}'s biography language is not in {', '.join(field_bio_language)}. ({language}), skip.", + f"@{username}'s biography language is not in the list: {', '.join(field_bio_language)}. ({language}), skip.", extra={"color": f"{Fore.CYAN}"}, ) + skip_2 = True + if skip_1 or skip_2: return profile_data, self.return_check_profile( username, profile_data, diff --git a/config-examples/filters.yml b/config-examples/filters.yml index 92eaef84..7beebc0d 100644 --- a/config-examples/filters.yml +++ b/config-examples/filters.yml @@ -30,6 +30,7 @@ blacklist_words: [sex, link,] mandatory_words: [cat, dogs,] specific_alphabet: [LATIN, GREEK] biography_language: [it, en] +biography_banned_language: [es, ch] ## Filters for enabling comments # Action specific From 23a8ab4020b178fb5d3169e67fabc0e4476bb9a9 Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:00:49 +0200 Subject: [PATCH 3/9] perf: improved readability of the code and correct some typos --- GramAddict/core/bot_flow.py | 27 +++++++------------ GramAddict/core/utils.py | 39 +++++++++++++++------------- GramAddict/core/views.py | 4 +-- GramAddict/plugins/core_arguments.py | 2 +- GramAddict/plugins/telegram.py | 2 +- 5 files changed, 34 insertions(+), 40 deletions(-) diff --git a/GramAddict/core/bot_flow.py b/GramAddict/core/bot_flow.py index 501ba969..b11a8593 100644 --- a/GramAddict/core/bot_flow.py +++ b/GramAddict/core/bot_flow.py @@ -45,6 +45,8 @@ from GramAddict.core.views import AccountView, ProfileView, SearchView, TabBarView from GramAddict.core.views import load_config as load_views +TESTED_IG_VERSION = "202.0.0.37.123" + def start_bot(): # Pre-Load Config @@ -142,26 +144,15 @@ def start_bot(): logger.info("Device screen ON and unlocked.") if open_instagram(device, configs.args.screen_record, configs.args.close_apps): try: - tested_ig_version = "198.0.0.32.120" running_ig_version = get_instagram_version() - running_ig_version_splitted = running_ig_version.split(".") - last_ig_version_tested = tested_ig_version.split(".") logger.info(f"Instagram version: {running_ig_version}") - for n in range(len(running_ig_version_splitted)): - if int(running_ig_version_splitted[n]) > int( - last_ig_version_tested[n] - ): - logger.info( - f"You have a newer version of IG then the one we tested! (Tested version: {tested_ig_version})", - extra={"color": f"{Style.BRIGHT}"}, - ) - break - else: - if int(running_ig_version_splitted[n]) == int( - last_ig_version_tested[n] - ): - continue - break + if tuple(running_ig_version.split(".")) > tuple( + TESTED_IG_VERSION.split(".") + ): + logger.info( + f"You have a newer version of IG then the one we tested! (Tested version: {TESTED_IG_VERSION})", + extra={"color": f"{Style.BRIGHT}"}, + ) except Exception as e: logger.error(f"Error retrieving the IG version. Exception: {e}") diff --git a/GramAddict/core/utils.py b/GramAddict/core/utils.py index dd46e1c9..2989a728 100644 --- a/GramAddict/core/utils.py +++ b/GramAddict/core/utils.py @@ -259,7 +259,7 @@ def open_instagram(device, screen_record, close_apps): return False random_sleep() if close_apps: - logger.info("Close all the other apps, for avoid interferece..") + logger.info("Close all the other apps, to avoid interference...") device.deviceV2.app_stop_all(excludes=[app_id]) random_sleep() logger.debug("Setting FastInputIME as default keyboard.") @@ -295,7 +295,7 @@ def open_instagram(device, screen_record, close_apps): device.start_screenrecord() except Exception as e: logger.error( - f"For use the screen-record feature you have to install the requirements package! Run in the console: 'pip3 install -U 'uiautomator2[image]' -i https://pypi.doubanio.com/simple' Exception: {e}" + f"You can't use this feature without installing dependencies. Type that in console: 'pip3 install -U \"uiautomator2[image]\" -i https://pypi.doubanio.com/simple'. Exception: {e}" ) return True @@ -305,10 +305,10 @@ def close_instagram(device, screen_record): device.deviceV2.app_stop(app_id) if screen_record: try: - device.stop_screenrecord() + device.stop_screenrecord(crash=False) except Exception as e: logger.error( - f"For use the screen-record feature you have to install the requirements package! Run in the console: 'pip3 install -U 'uiautomator2[image]' -i https://pypi.doubanio.com/simple' Exception: {e}" + f"You can't use this feature without installing dependencies. Type that in console: 'pip3 install -U \"uiautomator2[image]\" -i https://pypi.doubanio.com/simple'. Exception: {e}" ) @@ -368,39 +368,42 @@ def random_sleep(inf=0.5, sup=3.0, modulable=True, logging=True): def save_crash(device): directory_name = __version__ + "_" + datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + crash_path = os.path.join("crashes", directory_name) try: - os.makedirs("crashes/" + directory_name + "/", exist_ok=False) + os.makedirs(crash_path, exist_ok=False) except OSError: - logger.error("Directory " + directory_name + " already exists.") + logger.error(f"Directory {directory_name} already exists.") return screenshot_format = ".png" try: - device.screenshot( - "crashes/" + directory_name + "/screenshot" + screenshot_format - ) + device.screenshot(os.path.join(crash_path, "screenshot" + screenshot_format)) except RuntimeError: logger.error("Cannot save screenshot.") view_hierarchy_format = ".xml" try: device.dump_hierarchy( - "crashes/" + directory_name + "/view_hierarchy" + view_hierarchy_format + os.path.join(crash_path, "view_hierarchy" + view_hierarchy_format) ) except RuntimeError: logger.error("Cannot save view hierarchy.") - + if args.screen_record: + device.stop_screenrecord() + files = [f for f in os.listdir("./") if f.endswith(".mp4")] + try: + os.replace(files[-1], os.path.join(crash_path, "video.mp4")) + except (FileNotFoundError, IndexError): + logger.error("File *.mp4 not found!") g_log_file_name, g_logs_dir, _, _ = get_log_file_config() - src_file = f"{g_logs_dir}/{g_log_file_name}" - target_file = f"crashes/{directory_name}/logs.txt" + src_file = os.path.join(g_logs_dir, g_log_file_name) + target_file = os.path.join(crash_path, "logs.txt") shutil.copy(src_file, target_file) - shutil.make_archive( - "crashes/" + directory_name, "zip", "crashes/" + directory_name + "/" - ) - shutil.rmtree("crashes/" + directory_name + "/") + shutil.make_archive(crash_path, "zip", crash_path) + shutil.rmtree(crash_path) logger.info( - 'Crash saved as "crashes/' + directory_name + '.zip".', + f"Crash saved as {crash_path}.zip", extra={"color": Fore.GREEN}, ) logger.info( diff --git a/GramAddict/core/views.py b/GramAddict/core/views.py index 4b280a6d..c848fc71 100644 --- a/GramAddict/core/views.py +++ b/GramAddict/core/views.py @@ -736,12 +736,12 @@ def _get_number_of_likers(self, likes_view): elif hasattr(matches_view, "group"): views = int(matches_view.group("views")) logger.info( - f"I can see only that this post has {views} views(s). It may contains likes.." + f"I can see only that this post has {views} views(s). It may contain likes.." ) return -1 else: if likes_view_text.endswith("others"): - logger.info("This post has more then 1 like.") + logger.info("This post has more than 1 like.") return -1 else: logger.info("This post has only 1 like.") diff --git a/GramAddict/plugins/core_arguments.py b/GramAddict/plugins/core_arguments.py index af9abaff..f82934aa 100644 --- a/GramAddict/plugins/core_arguments.py +++ b/GramAddict/plugins/core_arguments.py @@ -197,7 +197,7 @@ def __init__(self): }, { "arg": "--screen-record", - "help": "enable screen recording: it will be saved as debug.mp4", + "help": "enable screen recording for debugging", "action": "store_true", }, { diff --git a/GramAddict/plugins/telegram.py b/GramAddict/plugins/telegram.py index 0da8953b..e347c1b8 100644 --- a/GramAddict/plugins/telegram.py +++ b/GramAddict/plugins/telegram.py @@ -183,7 +183,7 @@ def undentString(string): • {str(df["comments"].iloc[-1])} comments done • {str(df["pm_sent"].iloc[-1])} PM sent - *📅 Today total actions* + *📅 Todays total actions* • {str(dailySummary["duration"].iloc[-1])} minutes of botting • {str(dailySummary["likes"].iloc[-1])} likes • {str(dailySummary["followed"].iloc[-1])} follows From 9aadf82e380f965bf9b01ad4bf3d7cd4769e508c Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:02:24 +0200 Subject: [PATCH 4/9] Update handle_sources.py perf: get rid of white lines in handle_blogger_form_file job --- GramAddict/core/handle_sources.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GramAddict/core/handle_sources.py b/GramAddict/core/handle_sources.py index 1aebbd20..3d376356 100644 --- a/GramAddict/core/handle_sources.py +++ b/GramAddict/core/handle_sources.py @@ -1,4 +1,5 @@ import logging +import os from datetime import timedelta from functools import partial from os import path @@ -157,6 +158,9 @@ def handle_blogger_from_file( limit_reached = False if path.isfile(current_filename): with open(current_filename, "r") as f: + nonempty_lines = [line.strip("\n") for line in f if line != "\n"] + logger.info(f"In this file there are {len(nonempty_lines)} entries.") + f.seek(0) for line in f: username = line.strip() if username != "": @@ -231,7 +235,9 @@ def handle_blogger_from_file( with atomic_write(current_filename, overwrite=True, encoding="utf-8") as f: f.writelines(remaining) else: - logger.warning(f"File {current_filename} not found.") + logger.warning( + f"File {current_filename} not found. You have to specify the right relative path from this point: {os.getcwd()}" + ) return logger.info(f"Interact with users in {current_filename} completed.") From bb5c13104b2df11883d6b06d997d06473c89adbb Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 17:30:58 +0200 Subject: [PATCH 5/9] feat: new job to unfollow people who are following you unfollow-any-followers job #212 --- .../plugins/action_unfollow_followers.py | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/GramAddict/plugins/action_unfollow_followers.py b/GramAddict/plugins/action_unfollow_followers.py index 19de7b5c..b619e63c 100644 --- a/GramAddict/plugins/action_unfollow_followers.py +++ b/GramAddict/plugins/action_unfollow_followers.py @@ -55,6 +55,14 @@ def __init__(self): "default": None, "operation": True, }, + { + "arg": "--unfollow-any-followers", + "nargs": None, + "help": "unfollow at most given number of users, that follow you back. The order is from oldest to newest followings. It can be a number (e.g. 10) or a range (e.g. 10-20)", + "metavar": "10-20", + "default": None, + "operation": True, + }, { "arg": "--unfollow-any", "nargs": None, @@ -110,6 +118,8 @@ def __init__(self): self.unfollow_type = UnfollowRestriction.FOLLOWED_BY_SCRIPT_NON_FOLLOWERS elif self.unfollow_type == "unfollow-any-non-followers": self.unfollow_type = UnfollowRestriction.ANY_NON_FOLLOWERS + elif self.unfollow_type == "unfollow-any-followers": + self.unfollow_type = UnfollowRestriction.ANY_FOLLOWERS else: self.unfollow_type = UnfollowRestriction.ANY @@ -335,7 +345,10 @@ def iterate_over_followings( unfollow_restriction == UnfollowRestriction.FOLLOWED_BY_SCRIPT_NON_FOLLOWERS or unfollow_restriction - == UnfollowRestriction.ANY_NON_FOLLOWERS, + == UnfollowRestriction.ANY_NON_FOLLOWERS + or unfollow_restriction + == UnfollowRestriction.ANY_FOLLOWERS, + True if job_name == "unfollow-any-followers" else False, ) if unfollowed: @@ -386,7 +399,12 @@ def iterate_over_followings( return def do_unfollow( - self, device: DeviceFacade, username, my_username, check_if_is_follower + self, + device: DeviceFacade, + username, + my_username, + check_if_is_follower, + unfollow_followers=False, ): """ :return: whether unfollow was successful @@ -404,11 +422,13 @@ def do_unfollow( is_following_you = self.check_is_follower(device, username, my_username) if is_following_you is not None: if check_if_is_follower and is_following_you: - logger.info(f"Skip @{username}. This user is following you.") - logger.info("Back to the followings list.") - device.back() - return False - + if not unfollow_followers: + logger.info(f"Skip @{username}. This user is following you.") + logger.info("Back to the followings list.") + device.back() + return False + else: + logger.info(f"@{username} is following you, unfollow. 😈") unfollow_button = device.find( classNameMatches=ClassName.BUTTON_OR_TEXTVIEW_REGEX, clickable=True, @@ -511,3 +531,4 @@ class UnfollowRestriction(Enum): FOLLOWED_BY_SCRIPT = 1 FOLLOWED_BY_SCRIPT_NON_FOLLOWERS = 2 ANY_NON_FOLLOWERS = 3 + ANY_FOLLOWERS = 4 From a81000e6cc061b0cf042ff895ce69d519111ee19 Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 18:32:47 +0200 Subject: [PATCH 6/9] feat: new argument to control how many skips in jobs with posts (e.g.: hashtag-post-top) are allowed before moving to another source / job new argument: skipped-post-limit: 5-10 5 by default it works with all kind of posts jobs --- GramAddict/core/handle_sources.py | 16 +++++++++++++++- GramAddict/plugins/core_arguments.py | 7 +++++++ config-examples/config.yml | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/GramAddict/core/handle_sources.py b/GramAddict/core/handle_sources.py index 3d376356..f29e014f 100644 --- a/GramAddict/core/handle_sources.py +++ b/GramAddict/core/handle_sources.py @@ -451,6 +451,11 @@ def handle_posts( interact_percentage, scraping_file, ): + skipped_post_limit = get_value( + self.args.skipped_post_limit, + "Skipped post limit: {}", + 5, + ) if current_job == "feed": nav_to_feed(device) count_feed_limit = get_value( @@ -467,6 +472,7 @@ def handle_posts( post_description = "" nr_same_post = 0 nr_same_posts_max = 3 + nr_consecutive_already_interacted = 0 while True: flag, post_description, username, is_ad, is_hashtag = PostsViewList( device @@ -509,11 +515,19 @@ def handle_posts( ) if can_reinteract: can_interact = True + nr_consecutive_already_interacted = 0 + else: + nr_consecutive_already_interacted += 1 else: can_interact = True + nr_consecutive_already_interacted = 0 else: can_interact = True - + if nr_consecutive_already_interacted == skipped_post_limit: + logger.info( + f"Reached the limit of already interacted {skipped_post_limit}. Goin to the next source/job!" + ) + return if can_interact and (likes_in_range or not has_likers): logger.info( f"@{username}: interact", extra={"color": f"{Fore.YELLOW}"} diff --git a/GramAddict/plugins/core_arguments.py b/GramAddict/plugins/core_arguments.py index f82934aa..bd2afa94 100644 --- a/GramAddict/plugins/core_arguments.py +++ b/GramAddict/plugins/core_arguments.py @@ -311,6 +311,13 @@ def __init__(self): "metavar": "5-10", "default": "5", }, + { + "arg": "--skipped-post-limit", + "nargs": None, + "help": "limit on how many skips for posts already interacted are allowed before going to the next job/source, 5 by default", + "metavar": "5-10", + "default": "5", + }, { "arg": "--uia-version", "nargs": None, diff --git a/config-examples/config.yml b/config-examples/config.yml index 120c59b9..8af71c9f 100644 --- a/config-examples/config.yml +++ b/config-examples/config.yml @@ -59,6 +59,7 @@ unfollow: 10-20 unfollow-any: 10-20 unfollow-non-followers: 10-20 unfollow-any-non-followers: 10-20 +unfollow-any-followers: 10-20 unfollow-from-file: [usernames1.txt, usernames2.txt] sort-followers-newest-to-oldest: false @@ -84,6 +85,7 @@ interact-percentage: 30-40 follow-percentage: 30-40 follow-limit: 50 skipped-list-limit: 10-15 +skipped-post-limit: 5 fling-when-skipped: 0 min-following: 100 From 0cdfd649427d0cefcb7da55b72d86a6da5032caf Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 18:37:40 +0200 Subject: [PATCH 7/9] v2.9.0 with dependencies upgrade --- CHANGELOG.md | 14 ++++++++++++++ GramAddict/version.py | 2 +- requirements.txt | 10 +++++----- setup.py | 10 +++++----- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d9bc5b..42ae3695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 2.9.0 (2021-08-24) + +#### New Features + +* new argument to control how many skips in jobs with posts (e.g.: hashtag-post-top) are allowed before moving to another source / job +* new job to unfollow people who are following you +* new filter for skipping accounts with banned biography language +#### Performance improvements + +* improved readability of the code and correct some typos +* moving sibling folders of run.py will no longer executed automatically + +Full set of changes: [`2.8.0...2.9.0`](https://github.com/GramAddict/bot/compare/2.8.0...2.9.0) + ## 2.8.0 (2021-08-04) #### New Features diff --git a/GramAddict/version.py b/GramAddict/version.py index 892994aa..43ce13db 100644 --- a/GramAddict/version.py +++ b/GramAddict/version.py @@ -1 +1 @@ -__version__ = "2.8.0" +__version__ = "2.9.0" diff --git a/requirements.txt b/requirements.txt index 19211806..0fce70ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ colorama==0.4.4 -ConfigArgParse==1.4 +ConfigArgParse==1.5.2 numpy==1.20.3 -PyYAML==5.4 -uiautomator2==2.16.6 -urllib3==1.26.5 -emoji==1.2.0 +PyYAML==5.4.1 +uiautomator2==2.16.7 +urllib3==1.26.6 +emoji==1.4.2 langdetect==1.0.9 atomicwrites==1.4.0 spintax==1.0.4 \ No newline at end of file diff --git a/setup.py b/setup.py index fb4ffeb2..375879f7 100644 --- a/setup.py +++ b/setup.py @@ -17,12 +17,12 @@ include_package_data=True, install_requires=[ "colorama==0.4.4", - "ConfigArgParse==1.4", + "ConfigArgParse==1.5.2", "numpy>=1.19.5,<=1.20.3", - "PyYAML==5.4", - "uiautomator2==2.16.6", - "urllib3==1.26.5", - "emoji==1.2.0", + "PyYAML==5.4.1", + "uiautomator2==2.16.7", + "urllib3==1.26.6", + "emoji==1.4.2", "langdetect==1.0.9", "atomicwrites==1.4.0", "spintax==1.0.4", From f62da36625ffb52a5cbf7217a155623d049c0813 Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Tue, 24 Aug 2021 19:03:08 +0200 Subject: [PATCH 8/9] typo --- GramAddict/core/handle_sources.py | 8 ++++---- GramAddict/plugins/core_arguments.py | 2 +- config-examples/config.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GramAddict/core/handle_sources.py b/GramAddict/core/handle_sources.py index f29e014f..d0137463 100644 --- a/GramAddict/core/handle_sources.py +++ b/GramAddict/core/handle_sources.py @@ -451,8 +451,8 @@ def handle_posts( interact_percentage, scraping_file, ): - skipped_post_limit = get_value( - self.args.skipped_post_limit, + skipped_posts_limit = get_value( + self.args.skipped_posts_limit, "Skipped post limit: {}", 5, ) @@ -523,9 +523,9 @@ def handle_posts( nr_consecutive_already_interacted = 0 else: can_interact = True - if nr_consecutive_already_interacted == skipped_post_limit: + if nr_consecutive_already_interacted == skipped_posts_limit: logger.info( - f"Reached the limit of already interacted {skipped_post_limit}. Goin to the next source/job!" + f"Reached the limit of already interacted {skipped_posts_limit}. Goin to the next source/job!" ) return if can_interact and (likes_in_range or not has_likers): diff --git a/GramAddict/plugins/core_arguments.py b/GramAddict/plugins/core_arguments.py index bd2afa94..cd8d20dc 100644 --- a/GramAddict/plugins/core_arguments.py +++ b/GramAddict/plugins/core_arguments.py @@ -312,7 +312,7 @@ def __init__(self): "default": "5", }, { - "arg": "--skipped-post-limit", + "arg": "--skipped-posts-limit", "nargs": None, "help": "limit on how many skips for posts already interacted are allowed before going to the next job/source, 5 by default", "metavar": "5-10", diff --git a/config-examples/config.yml b/config-examples/config.yml index 8af71c9f..6aea8ffb 100644 --- a/config-examples/config.yml +++ b/config-examples/config.yml @@ -85,7 +85,7 @@ interact-percentage: 30-40 follow-percentage: 30-40 follow-limit: 50 skipped-list-limit: 10-15 -skipped-post-limit: 5 +skipped-posts-limit: 5 fling-when-skipped: 0 min-following: 100 From 99fcecf09b63030c2a80964e684fc234d03d926d Mon Sep 17 00:00:00 2001 From: Dennis <52335835+mastrolube@users.noreply.github.com> Date: Wed, 25 Aug 2021 13:51:02 +0200 Subject: [PATCH 9/9] sort import --- GramAddict/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/GramAddict/__main__.py b/GramAddict/__main__.py index 5b9b3af1..debf149e 100644 --- a/GramAddict/__main__.py +++ b/GramAddict/__main__.py @@ -1,8 +1,9 @@ import argparse from os import getcwd, path -from GramAddict.version import __version__ -from GramAddict.core.download_from_github import download_from_github + from GramAddict.core.bot_flow import start_bot +from GramAddict.core.download_from_github import download_from_github +from GramAddict.version import __version__ def cmd_init(args): @@ -34,10 +35,11 @@ def cmd_run(args): def cmd_dump(args): - import uiautomator2 as u2 - import shutil import os + import shutil import time + + import uiautomator2 as u2 from colorama import Fore, Style os.popen("adb shell pkill atx-agent").close()