Last active
October 28, 2021 21:25
-
-
Save impure/b47e29dc4fddf38a68d3dc3fc651691e to your computer and use it in GitHub Desktop.
This file contains 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
import clipboard | |
import re | |
text = clipboard.paste() | |
start = text.find("Posted by") | |
end = text.rfind("Reply\nGive Award\nShare\nReport\nSave\nFollow\nAbout Community") | |
if start == -1 or end == -1: | |
print(text) | |
exit() | |
text = text[start:end] | |
text = text.replace("Reply\nGive Award\nShare\nReport\nSave\nFollow\nAbout Community", "") | |
text = text.replace("Reply\nGive Award\nShare\nReport\nSave\nFollow", "") | |
text = text.replace("Comments\n\nAward\n\nShare\n\nSave\n\nHide\n\nReport", "") | |
text = text.replace("Comments\n\nAward\n\nShare\n\nSave\n\nHide", "") | |
text = re.sub(r'\n+', r'\n', text) | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment