lunaneff / no-google-amp-bot Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Only bots that I authorize should be posting in my subreddit. How to ensure this doesn't happen again?
When someone posts a comment containing two or more google amp links only the first one gets processed.
Would be nice if the bot could process multiple links and display them in the same order as they appear in the comment.
https://www.reddit.com/r/Baofeng/comments/looafu/uv5r_voice_modulation_improvement_mod/go7gahd/
Non-AMP Links:
https://www.google.com/amp/s/rolfje.wordpress.com/2015/05/10/better-modulation-for-the-baofeng-uv-5ra/amp/
https://rolfje.wordpress.com/2015/05/10/better-modulation-for-the-baofeng-uv-5ra/I'm a bot. Why? | Code | Report issues
I think the most reliable way to get the correct target page is to retrieve the google amp link and look for canonical relation in the HTML and embedded Javascript. Consider the following PCRE regexps:
<link\s+rel="?canonical"?\s+href="?(.*?)"?\s*/?>
<link\s+href="?(.*?)"?\s+rel="?canonical"?\s*/?>
"canonicalUrl":"(.*?)"
The target URL would be in the first grouping.
See this thread: https://www.reddit.com/r/Smartphones/comments/lis1c7/which_of_these_midrange_low_range_phones_do_you/gn543tb/
It appears the bot cut off everything after "one".
It posted the website icon instead of a link to the article.
Please, please, please: if your bot has to exist, can't it be less verbose? I think it would really improve the reading experience on Reddit if its comments were as brief as possible. I'd advocate for something like:
Non-AMP link: https://www.example.com
Why?
That is a service. Its current verbosity is self-important, self-promoting spam.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.