Skip to content

Commit 55ffc48

Browse files
committed
A rewrite of AmputatorBot from the very ground up - check out the entire changelog of v3.0 here: https://www.reddit.com/r/AmputatorBot/comments/i1wruh/amputatorbot_v30_better_bot/
1 parent 2f3fbf0 commit 55ffc48

38 files changed

+1895
-1326
lines changed

Diff for: .github/FUNDING.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# Hey there! I absolutely love open sourcing and AmputatorBot, but it costs me €8.26 per month to host the bot 24/7.
2-
# This isn't much, obviously. But it adds up quickly.
1+
# Hi there! The bot and website cost approximately €8.26 a month to host and while that might not seem like much,
2+
# it adds up. All donations will ONLY be used to pay for hosting. You can specify any amount you want, but please
3+
# keep in mind that I only want to try to cover some of the costs. Thank you so much!
34

4-
# This link will direct you to my PayPal donation page, where you can fill in any amount you want.
5-
# Just remember that I'm only trying to cover the costs ;)
6-
# Massive thx!
7-
8-
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2&source=url
5+
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2

Diff for: .gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,9 @@ venv.bak/
104104
.mypy_cache/
105105

106106
# local project stuff
107-
config.py
107+
/static/static.py
108+
/logs/v3.0/
109+
/data/
110+
/img/dev/
111+
/.idea/
112+
/amputatorbotcom/

Diff for: LICENSE

-53
Original file line numberDiff line numberDiff line change
@@ -619,56 +619,3 @@ Program, unless a warranty or assumption of liability accompanies a
619619
copy of the Program in return for a fee.
620620

621621
END OF TERMS AND CONDITIONS
622-
623-
How to Apply These Terms to Your New Programs
624-
625-
If you develop a new program, and you want it to be of the greatest
626-
possible use to the public, the best way to achieve this is to make it
627-
free software which everyone can redistribute and change under these terms.
628-
629-
To do so, attach the following notices to the program. It is safest
630-
to attach them to the start of each source file to most effectively
631-
state the exclusion of warranty; and each file should have at least
632-
the "copyright" line and a pointer to where the full notice is found.
633-
634-
<one line to give the program's name and a brief idea of what it does.>
635-
Copyright (C) <year> <name of author>
636-
637-
This program is free software: you can redistribute it and/or modify
638-
it under the terms of the GNU General Public License as published by
639-
the Free Software Foundation, either version 3 of the License, or
640-
(at your option) any later version.
641-
642-
This program is distributed in the hope that it will be useful,
643-
but WITHOUT ANY WARRANTY; without even the implied warranty of
644-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645-
GNU General Public License for more details.
646-
647-
You should have received a copy of the GNU General Public License
648-
along with this program. If not, see <https://www.gnu.org/licenses/>.
649-
650-
Also add information on how to contact you by electronic and paper mail.
651-
652-
If the program does terminal interaction, make it output a short
653-
notice like this when it starts in an interactive mode:
654-
655-
<program> Copyright (C) <year> <name of author>
656-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657-
This is free software, and you are welcome to redistribute it
658-
under certain conditions; type `show c' for details.
659-
660-
The hypothetical commands `show w' and `show c' should show the appropriate
661-
parts of the General Public License. Of course, your program's commands
662-
might be different; for a GUI interface, you would use an "about box".
663-
664-
You should also get your employer (if you work as a programmer) or school,
665-
if any, to sign a "copyright disclaimer" for the program, if necessary.
666-
For more information on this, and how to apply and follow the GNU GPL, see
667-
<https://www.gnu.org/licenses/>.
668-
669-
The GNU General Public License does not permit incorporating your program
670-
into proprietary programs. If your program is a subroutine library, you
671-
may consider it more useful to permit linking proprietary applications with
672-
the library. If this is what you want to do, use the GNU Lesser General
673-
Public License instead of this License. But first, please read
674-
<https://www.gnu.org/licenses/why-not-lgpl.html>.

Diff for: README.md

+37-24
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,55 @@
1-
![#AmputatorBot](/img/amputatorbot-v3.2.1.png)
2-
TL;DR: AmputatorBot is a Reddit bot that replies to comments and submissions containing AMP URLs with the direct and original link.
1+
![#AmputatorBot](/img/amputatorbot_logo_banner.png)
32

4-
## Why AMP is a threat to the Open Web
5-
**What is AMP?** AMP is an open-source web component framework aimed at improving the UX of websites, stories, ads and mail. It was first announced by Google in 2015 and has grown considerably since then. But the project has also been subject to a lot criticism.
3+
TL;DR: AmputatorBot is a Reddit bot that replies to comments and submissions containing AMP URLs with the canonical URL.
64

7-
**AMP threatens the Open Web.** For example, Google mobile Search’s Top Stories carousel has a premium position above of all other results, which is only accessible for cached AMP pages. This has the effect of further reinforcing Google’s dominance of the Web.
5+
**[FAQ, About & Why](https://www.reddit.com/r/AmputatorBot/comments/ehrq3z/why_did_i_build_amputatorbot/)**
86

9-
Other concerns include: the questionable performance boost, the way cached AMP pages keep users in Google's ecosystem, the obscurity of publishers's domains on cached AMP pages, the loss of sovereignty of websites, the lack of functionality and diversity on some AMP pages and of course, privacy concerns.
7+
## Features
108

11-
To sum up, AMP and it's implementation have some major flaws that threaten the Open Web. And as long as that's the case, [u/AmputatorBot](https://www.reddit.com/u/AmputatorBot/) and [AmputatorBot.com](https://www.amputatorbot.com/) will be there to remove AMP from your URLs.
9+
![#AmputatorBot demo](/img/amputatorbot_demo.png)
1210

13-
[ⓘ Please note: For a much more detailed explanation with sources, click here.](https://www.reddit.com/r/AmputatorBot/comments/ehrq3z/why_did_i_build_amputatorbot/)
14-
15-
## More info & features
16-
**[Check out this post for more detailed info](https://www.reddit.com/r/AmputatorBot/comments/ehrq3z/why_did_i_build_amputatorbot/)**
17-
18-
Some other features include:
19-
- Automatically keep track of items interacted with
11+
Features include:
12+
- Automatically create required log and datafiles
13+
- Scan for comments, submissions and mentions
14+
- Check each item against specified criteria
15+
- Strip URLs of markdown
16+
- Check URLs for AMP links
17+
- Find canonicals using 9 different methods
18+
- Calculate which canonical is 'best'
19+
- Return 2 canonicals if the canonicals have more than 1 domain
20+
- Return an AMP-canonical if the real canonical can't be found
21+
- Generate and send automatic replies to AMP items with the canonical(s) and some info
22+
- Automatically keep track of bans
23+
- Keep track of items interacted with
2024
- Let users opt-out and opt-back-in
2125
- Send DMs when summoned by users
22-
- Check multiple criteria
23-
- Strip URLs of markdown
24-
- Find the canonical link using 3 different methods
25-
- Detailed debug-info
26+
- Experimental: Guess-and-check method with article-comparison
27+
- Local- and SQL-database-logging
2628

27-
Also:
29+
Please note:
2830
- AmputatorBot works automatically in a select number of subreddits
2931
- AmputatorBot won't work in subreddits where it is banned or forbidden
30-
- There's also a website: [AmputatorBot.com](https://www.amputatorbot.com/)
31-
- You can find the changelog [here!](https://www.reddit.com/r/AmputatorBot/comments/ch9fxp/changelog_of_amputatorbot/)!
32+
- The online version of AmputatorBot can be found at [AmputatorBot.com](https://www.amputatorbot.com/)
33+
- You can find the changelog [here](https://www.reddit.com/r/AmputatorBot/comments/ch9fxp/changelog_of_amputatorbot/)!
34+
35+
## Set up
36+
37+
1. Clone the repository
38+
2. Fill in and change the required values in static.txt (see /static)
39+
3. Change the filename of static.txt to .py
40+
4. Choose which script(s) you want to run (check_comments.py, check_inbox.py or check_submissions.py)
41+
5. Set the 'settings' in the run_bot function of the script. I recommended to set everything (guess_and_check, reply_to_post, write_to_database) to False when you are starting out.
42+
6. Run the script - All logs and required datafiles will be automatically and dynamically created. In /data: allowed_subreddits.txt, comments_failed.txt, comments_success.txt, disallowed_mods.txt, disallowed_subreddits.txt, disallowed_users.txt, mentions_failed.txt, mentions.success.txt, np_subreddits.txt, problematic_domains.txt, submissions_failed.txt, submissions_success.txt and in /logs: check_comments_X.X.log, check_inbox_X.X.log and check_submissions_X.X.log.
43+
7. Stop the script to see and edit the newly generated files. Odds are you want to add subreddits to allowed_subreddits.txt (for example: ,subreddit1,subreddit2)
44+
8. Re-run the script
3245

3346
## Support the project
3447

35-
**.. By donating**: The bot and website cost approximately €8.26 a month to host and while that might not seem like much, it adds up. All donations will ONLY be used to pay for hosting. You can specify any amount you want, but please keep in mind that I only want to try to cover some of the costs. Thank you so much! - [https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2)
48+
**.. By summoning the bot**: If you've spotted an AMP URL on Reddit and [u/AmputatorBot](https://www.reddit.com/u/AmputatorBot/) seems absent, you can summon the bot by mentioning [u/AmputatorBot](https://www.reddit.com/u/AmputatorBot/) in a reply to the comment or submission containing the AMP URL. You'll receive a confirmation through PM. For more details, check out [this post](https://www.reddit.com/r/AmputatorBot/comments/cchly3/you_can_now_summon_amputatorbot/)!
3649

37-
**.. By giving feedback**: Most new features were made after suggestions from you guys, so whether you have positive or negative feedback, please let me know! You can contact me on Reddit, [fill an issue](https://github.com/KilledMufasa/AmputatorBot/issues) or [make a pull request](https://github.com/KilledMufasa/AmputatorBot/issues).
50+
**.. By giving feedback**: Most of the new features were made after suggestions from you guys, so hit me up if you have any feedback! You can contact me on Reddit, [fill an issue](https://github.com/KilledMufasa/AmputatorBot/issues) or [make a pull request](https://github.com/KilledMufasa/AmputatorBot/issues).
3851

39-
**.. By summoning the bot**: If you've spotted an AMP URL and [u/AmputatorBot](https://www.reddit.com/u/AmputatorBot/) seems absent, you can summon the bot by mentioning [u/AmputatorBot](https://www.reddit.com/u/AmputatorBot/) in a reply to the comment or submission containing the AMP URL. You'll receive a confirmation through PM. For more details, check out [this post](https://www.reddit.com/r/AmputatorBot/comments/cchly3/you_can_now_summon_amputatorbot/)!
52+
**.. By sponsoring**: The bot and website cost approximately €8.26 a month to host and while that might not seem like much, it adds up. All donations will be used ONLY to pay for hosting. You can specify any amount you want, but please keep in mind that I only want to try to cover some of the costs. Thank you so much! - [https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EU6ZFKTVT9VH2)
4053

4154
**.. By spreading the word**: In the end, the only goal of AmputatorBot is to allow people to have an informed choice. You can help by spreading the word in whatever way you deem the most appropriate.
4255

0 commit comments

Comments
 (0)