Comment Snob

Comment Snob is an extension for Google Chrome and Mozilla Firefox that filters out undesirable comments from comment threads on the Web. You can install it in Chrome or install it in Firefox.

Before:

After:

It comes with support for YouTube by default, but you can add support for many other sites by installing Comment Snob rules. For each rule that you install, you can choose from the following filtering parameters:

  • All capital letters
  • No capital letters
  • Doesn't start with a capital letter
  • Excessive punctuation (!!!! ????)
  • Excessive capitalization
  • Profanity
  • Contains any words or phrases that you deem objectionable.

Installing Comment Snob Rules

There are two ways to install a comment snob rule:

  1. Click on a Comment Snob rule link in a webpage. A bar will appear at the top of your browser allowing you to install the rule. (Try clicking this link: Comment Snob Rule for Mashable)

  2. Or, open the Comment Snob options and write your own Comment Snob rule.

Featured Comment Snob Rules

Writing a Comment Snob Rule

Are you familiar with HTML and jQuery? Then you can write Comment Snob rules for any website you want.

Components of a Rule

A Comment Snob rule is a JSON object that tells Comment Snob how to find comments on a website and where to place the "Show/Hide" toggle for each comment. These are the properties that each rule should (or can) have; all selectors should be written for consumption by jQuery:

Attribute Required Description
id Yes A string that should be unique to your rule. This is used to make sure that the same rule is not installed multiple times.
label Yes A string that describes your rule to a user. It will usually be the name of the website that it filters.
url Yes A regular expression (encoded in a string) that describes the URLs for which your rule should be run.
allCommentsSelector Yes A selector that selects the smallest possible container that contains all of the comments for the page.
commentContainerSelector Yes A selector that selects the largest possible container that contains only a single comment, using allCommentsSelector as a starting point.
commentTextSelector Optional A selector that selects the smallest possible container that contains all of the text for a comment, using commentContainerSelector. If not specified, defaults to commentContainerSelector.
commentHideSelector Optional A selector that selects any nodes that should be hidden when a comment is filtered, using commentContainerSelector as a starting point. If not specified, commentTextSelector will be used.
statusElementTag Optional The HTML tag name that should be used to hold the "Show/Hide" toggle and the reason for filtering. If not specified, defaults to "span".
statusContainerSelector Optional A selector that selects the element that will be used as a point of reference for where the "show/hide" toggle and filtering reason is placed for each comment. If not specified, defaults to commentContainerSelector.
statusPlacement Optional One of "prepend", "append", "before", or "after"; used along with statusContainerSelector to insert the filtering status into each filtered comment. Defaults to "prepend".
statusElementAttributes Optional A hash containing name/value pairs for attributes that can be added to the placeholder element specified by statusElementTag.
ajaxInitiatorSelector Optional A selector that selects any UI elements that might be clicked to trigger loading more comments via AJAX, using allCommentsSelector as a starting point.
dynamic Optional A boolean value (defaults to false) that indicates whether the website's comments are not included in the main pageload, but are immediately loaded after the page loads. Disqus is the most common example of this.
updateURL Optional A URL where the JSON for this rule can be retrieved (for automatic updates).
author Optional Your name, email address, or website.
description Optional A text description of your rule, only recommended if the label doesn't fully describe the functionality.

The simplest possible rule might look like this:

{
	"id": "test@example.com",
	"label": "Example.com",
	"url": "^http://example\\.com/",
	"allCommentsSelector": "#comments",
	"commentContainerSelector": ".comment"
}

Rule Discovery

To let users install your rule, just link to a file that ends in .snob and contains only the JSON, or make your link in this format:

	data:text/snob+json;base64,[base64-encoded JSON here]

Questions?

E-mail me at cfinke@gmail.com.

31 thoughts on “Comment Snob

        1. If you’re running Comment Snob 4, it will update the YouTube rule within a few days. If you don’t want to wait, you can go into the Comment Snob preferences, go to the YouTube rule, click “Edit this rule” and replace this line:

          "url": "^http://www\\.youtube\\.com/.*$",

          with this line:

          "url": "^https?://www\\.youtube\\.com/.*$",

          and click save. Then, it should filter comments on all videos.

          1. That worked perfectly, thank you! And I’d just like to say, this add-on is probably the best thing I’ve ever used in my browser.

  1. Hi Chris,

    thanks for your extension. However I cannot get it to work. I want to block a few trolls in the comments of vz.lt

    Here’s the rule I use:

    { 
    "id": "vz.lt", 
    "label": "vz.lt", 
    "url": "^http://vz\\.lt/.*$", 
    "allCommentsSelector": ".content", 
    "commentContainerSelector": ".comment" 
    }

    And in the preferences (“Contains one of these keywords or phrases”), I add the IP of the troll. However, only the first or the first few comments are filtered and the rest remains visible. Do I need to correct the rule? Or anything else? Thanks a million!

          1. Hi Chris,

            any news on the Chrome update? The Firefox version works fine, however the Chrome version still filters out only the first instance of the comment. Thanks!

  2. This is a great idea! Reading news sites without completely losing faith in humanity. Do you think there’s a way to make it work in Safari?

  3. Hi Chris,

    Do you have a rule, or would it be possible to make one, that would simply apply my default settings to all websites, rather than specific domains?

    Many thanks,
    –Justin

    1. No; the rules have to take into consideration the HTML of each website. If multiple sites used the same HTML (via the same WordPress theme, for example), you could make a single rule apply to both of them by writing the url attribute regex like this:

      "url": "^https?://((site1\.com)|(site2\.com))/.*
  4. I know this is a minor, and very specific thing, but…

    It would be great if any comments loaded after clicking the “Show more” button (in the new YouTube design) were also filtered.

    I’m not sure how this would be achieved, but maybe the extension’s code could be executed on each click of the “Show more” button(?)

    Irrespective of the above, it’s an excellent Extension! Thanks.

      1. Hi Christopher,

        I’ve just checked on another YouTube video, and, unfortunately, the behaviour I described is definitely happening.

        I checked whether it was being caused by another extension, and I’m now 95% sure it isn’t.

        Cheers.

  5. Hello,

    I’ve been using Comment Snob for a long time to block comments on YouTube. Over the past few weeks, I’ve noticed it’s stopped working.

    I’ve checked for extension conflicts by disabling all my extensions apart from Comment Snob. That didn’t fix it.

    Is there a bug fix for this, or will it have to involve writing a new version of the extension?

    Thanks.

    - Richard

    Versions:
    Comment Snob 6
    Chrome Version 26.0.1410.19 beta
    Mac OS 10.7.4

    Test videos: http://youtu.be/HYN6AiujIe0, http://youtu.be/ddgyg_5FF_0
    Grabs: http://screencast.com/t/6o0OZZpHHge, http://screencast.com/t/4XqIOdNwC55

  6. I was using the default filtering rules for YouTube in those test pages, and selected the “Hide all comments” option.
    Today, I installed Comment Snob on a clean Chrome profile and it worked. Then I went back to my usual profile, unchecked “Hide all comments”, and set “Hide comments with at least this many spelling mistakes” to 1, left every exception the profanity filter checked, and the comments were hidden.
    There were a few comments with spelling mistakes that weren’t hidden though. Apart from that it seems to be working.
    It’s a bit bizzarre, but Comment Snob is working. Sorry for the trouble.

  7. How on earth do things like f**cking and sh*t make it through? Any word that has an asterix in it should be disabled. Also, why would I want to know a bad comment was there? Please provide the ability to completely hide removed comments, I don’t need to know how many immature people there are on the web.

  8. Cool. Was able to address the asterix issue with the following in the keyword filter: \w+\*+\w+

    Also, sorry about my harsh tone before. You’ve done fantastic work with this plugin, and I’d love to see it become just that tiny bit better. You’re doing great work. Keep it up :)

  9. Wow. Just wow. In my humble opinion, this is the greatest extension EVER! Sadly, the level of discourse in comments on the internet has descended well below the level of graffiti on a Men’s Room wall, so, thank you, thank you, thank you, for this marvelous extension!

  10. For some reason Comment Snob is not working on Youtube. I’ve tried disabling and re-enabling it but it just won’t work.

  11. Thank you, Chris! Just tested it and it works fabulously on Youtube. A dream troll-free experience at last.

    You deserve a thousand kudos just for this.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>