Repository navigation
Skip Reddit submissions with removal metadata - #255
Open
xbloodyknight wants to merge 2 commits into
Open
xbloodyknight wants to merge 2 commits into
xbloodyknight wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The bot sent this removal notice to
@rStableDiffusionhttps://t.me/rStableDiffusion/67954:Reported post: https://redd.it/1wiuyhz
send_simplehas no check if the post is removed. A removal notice could therefore reach the existing text-sending code.Change
Add this guard before score checks and URL processing:
Remaining uncertainty
This should catch the reported post if Reddit provides removal metadata, but I couldn't confirm that without API credentials. @Fillll , could you verify this?
Why this should work in theory
PRAW's own recorded Data API response from May 2025 contains:
This directly confirms that the API PRAW uses returns this field and that it can be
null. Python decodes JSONnullasNone.PRAW exposes attributes returned by Reddit dynamically, so the guard reads the response field directly.
Reddit's removal-category documentation describes nonempty categories for removals, including content_takedown, copyright_takedown, moderator, and deleted. This documentation describes Devvit, rather than PRAW's Data API, so it supports the interpretation of removal categories but does not independently prove the Data API response for the reported post.
The reasoning is that a Reddit removal notice should carry a nonempty removal category. If it does, this guard rejects the submission before any sending code runs. The exact category does not matter because the guard accepts any truthy value.