From 4c3943296d6d2a96a365b5650d8bfbfcdafaeef3 Mon Sep 17 00:00:00 2001 From: ThioJoe <12518330+ThioJoe@users.noreply.github.com> Date: Sat, 5 Feb 2022 14:45:29 -0700 Subject: [PATCH] 2.15.0-Beta3 - Many Bug Fixes - Fixed log file path not being recognized with quotes around it #571 - Fixed crash when unable to encode certain unicode characters #568 - Fixed crash when writing JSON log #563 - Improve Filters #556 - Update default included spam lists - Change default log format from rtf to plaintext --- Scripts/files.py | 1 + Scripts/logging.py | 12 ++++++++++-- Scripts/prepare_modes.py | 2 +- YTSpammerPurge.py | 10 +++++----- assets/SpamDomainsList.txt | 16 +++++++++++++++- assets/SpamThreadsList.txt | 4 +++- assets/default_config.ini | 4 ++-- 7 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Scripts/files.py b/Scripts/files.py index 1e96347..e0a6d35 100644 --- a/Scripts/files.py +++ b/Scripts/files.py @@ -851,6 +851,7 @@ def parse_comment_list(config, recovery=False, removal=False, returnFileName=Fal if str(listFileName).lower() == "x": return "MainMenu", None + listFileName = listFileName.strip("\"").strip("'") # Remove quotes, if added by dragging and dropping or pasting path if len(listFileName) > 0: if os.path.exists(listFileName): pass diff --git a/Scripts/logging.py b/Scripts/logging.py index 06439c7..80971c3 100644 --- a/Scripts/logging.py +++ b/Scripts/logging.py @@ -4,6 +4,7 @@ from Scripts.shared_imports import * import Scripts.utils as utils import Scripts.auth as auth from Scripts.utils import choice +from unicodedata import category as unicode_category import rtfunicode import os @@ -287,7 +288,14 @@ def print_prepared_comments(current, commentsContents, scanVideoID, comments, j, # Takes in a string that contains unicode, and returns a string with properly escaped unicode format for use in rtf files # Uses 'rtfunicode' module to encode with proper rtf-compatible unicode escapes, then decode back to utf-8 so it can be written to file and read by wordpad or whatever def make_rtf_compatible(text): - return text.encode('rtfunicode').decode('utf-8') + try: + return text.encode('rtfunicode').decode('utf-8') + except: + intermediate = "".join(char for char in text if unicode_category(char) not in ["Mn", "Cc", "Cf", "Cs", "Co", "Cn"]) + try: + return intermediate.encode('rtfunicode').decode('utf-8') + except: + return intermediate # Writes properly to rtf file, also can prepare with necessary header information and formatting settings def write_rtf(fileName, newText=None, firstWrite=False, fullWrite=False): @@ -512,7 +520,7 @@ def get_extra_json_data(channelIDs, jsonSettingsDict): remainder = total % 50 numDivisions = int((total-remainder)/50) for i in range(numDivisions): - fetch_data(channelIDs[i*50:i*50+50]) + fetch_data(channelIDs[i*50:i*50+50]) if remainder > 0: fetch_data(channelIDs[numDivisions*50:]) else: diff --git a/Scripts/prepare_modes.py b/Scripts/prepare_modes.py index 78da586..473ee3a 100644 --- a/Scripts/prepare_modes.py +++ b/Scripts/prepare_modes.py @@ -315,7 +315,7 @@ def prepare_filter_mode_smart(scanMode, config, miscData, sensitive=False): # General Spammer Criteria #usernameBlackChars = "" spamGenEmoji_Raw = b'@Sl-~@Sl-};+UQApOJ|0pOJ~;q_yw3kMN(AyyC2e@3@cRnVj&SlB@' - usernameBlackWords_Raw = [b'aA|ICWn^M`', b'aA|ICWn>^?c>', b'Z*CxTWo%_2IbRcbcAY*7@', b'X>N0LVP|q-Z8`', b'Z*CxIZgX^D', b'Z*CxIZgX^DAZK!6Z2', b'c4=WCX>N0LVP|q-Z2', b'b9G`gb9G_', b'b9G`MG$3^?c>', b'Z*CxTWo%_2IbRcbcAY*7@', b'X>N0LVP|q-Z8`', b'Z*CxIZgX^D', b'Z*CxIZgX^DAZK!6Z2', b'c4=WCX>N0LVP|q-Z2', b'b9G`gb9G_', b'b9G`MG$3