From b11d65c9823c5e4986145793f205c0a653799f45 Mon Sep 17 00:00:00 2001 From: ThioJoe <12518330+ThioJoe@users.noreply.github.com> Date: Sat, 23 Dec 2023 20:34:48 -0500 Subject: [PATCH] Fix Community Comment Scanning - YouTube updated the web page layout source code at some point, so this fixes the references to the location of the posts Addresses #1082 --- .gitignore | 1 + Scripts/community_downloader.py | 5 +++-- YTSpammerPurge.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index fd595ef1..ebc0ceed 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,4 @@ SpamPurgeConfig.ini # Ignore Resources Folders spam_lists/ SpamPurge_Resources/ +.DS_Store diff --git a/Scripts/community_downloader.py b/Scripts/community_downloader.py index e4cd26e9..ffdad1b2 100644 --- a/Scripts/community_downloader.py +++ b/Scripts/community_downloader.py @@ -74,8 +74,9 @@ def fetch_recent_community_posts(channel_id): html = response.text data = json.loads(regex_search(html, YT_INITIAL_DATA_RE, default='')) - section = next(search_dict(data, 'itemSectionRenderer'), None) - rawPosts = list(search_dict(section, 'backstagePostRenderer')) + rendererSubsection = next(search_dict(data, 'twoColumnBrowseResultsRenderer'), None) + itemSection = next(search_dict(rendererSubsection, 'itemSectionRenderer'), None) + rawPosts = list(search_dict(itemSection, 'backstagePostRenderer')) recentPostsListofDicts = [] # Use list to keep in order - Puts post ID and sample of text into dictionary keypair, strips newlines # Gets the Post IDs and sample of post text diff --git a/YTSpammerPurge.py b/YTSpammerPurge.py index 9bb77745..12726202 100644 --- a/YTSpammerPurge.py +++ b/YTSpammerPurge.py @@ -36,7 +36,7 @@ ### IMPORTANT: I OFFER NO WARRANTY OR GUARANTEE FOR THIS SCRIPT. USE AT YOUR OWN RISK. ### I tested it on my own and implemented some failsafes as best as I could, ### but there could always be some kind of bug. You should inspect the code yourself. -version = "2.17.0" +version = "2.17.1" configVersion = 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# print("Importing Script Modules...")