5 ms·
Show HN: Chrome Extension to Filter HN Stories by Keyword
- alistproducer2 10y agoDev Here: I made this because I'm tired of seeing political flame-stories on here and I hate flagging them or, even worse, going in the threads to complain about them. With this extension you can make a comma-separated list of words that when matched within a headline, the link is removed from the page before you ever see it. You can check the console to see what stories are being removed. It's open source so feel free to fork, customize, contribute or whatever. It can be used to filter anything, so if you can't stand to see another "JavaScript" or "Python" story, you can block those too.
- detaro 10y agoGood idea, thanks for making it! > It's open source so feel free to fork, customize, contribute or whatever. Could you add a license to the repo then?
- alistproducer2 10y agoadded a GPL. thanks for reminding me.
- Shad0w59 10y agoGreat, now I can de-Trump my feed.
- kasbah 10y agoI thought about making something like this to filter out Apple stories actually. I use Firefox, might try and load this as a web extension.
- mp3geek 10y agoLoaded, but didnt show the icon in the bar.
- detaro 10y agoit uses an API that doesn't exist in Firefox to only trigger on news.ycombinator.com
- alistproducer2 10y agoif you don't mind, could you add that as an issue to the repo. I already have a contributor so maybe someone could pitch in and make it proper cross platform.
- alistproducer2 10y agoVersion < 0.4 have a bug that filters comments containing words on naughty list. 0.4 has been pushed to webstore but it will take a minute to propagate. If you want fixed version now, pull it from github. Although filtering out comments could be a feature and not a bug, amiright?
- cpeterso 10y agoI'd love to see an extension like this for Twitter.
- keyle 10y agoAnd Facebook!
- alistproducer2 10y agoI feel both of you! Feel free to fork it and make it work for whatever site you want. The code base is pretty straightforward. You'd just need to change the DOM logic (which is about 2 loc) so it should be pretty doable.
- cpeterso 10y agoOr an extension that understands how to parse many different news sites and can filter out stories on all of them. Add one keyword (pick your own example ;) and see no headlines containing that keyword on any news site. It wouldn't be that hard, though it would reinforce one's own news bubble.
- alistproducer2 10y agoI actually thought about something similar last night. Have a project that had a plugable DOM parser so people could build plug ins for various sites.
- unchaotic 10y agoSomewhat related : Wrote a chrome extension [1] to reduce some noise on twitter. It should be easy to add the ability to filter out tweets by keyword (I'll do it probably this weekend if it is useful). [1] https://chrome.google.com/webstore/detail/hackybird/ddlhmpomfloaidpdleeoegmpikjdchjf https://chrome.google.com/webstore/detail/hackybird/ddlhmpom...
- unchaotic 10y agoUpdated extension should now let you filter tweets based on keywords (& also sort tweets by popularity...) https://chrome.google.com/webstore/detail/hackybird/ddlhmpomfloaidpdleeoegmpikjdchjf https://chrome.google.com/webstore/detail/hackybird/ddlhmpom...
- elcapitan 10y agoDid it work for you? Filtering by title keywords only seems to be rather hard, especially for political stuff, which often uses rather non-descriptive headlines. Example: "New CIA Chief to Gladly Spy on Americans, Even If Using Info Hacked by Russians" looks like opinionism that I could pretty well live without, but it doesn't contain any keywords I would blacklist. For technical stuff it's probably a lot easier (just name the language/framework/etc).
- alistproducer2 10y agoYeah, I ran into something similar. I had "president" on my list and it blocked a story on the president of a company. It's kind of trial and error. That's why I find it useful to see what stories are blocked so you can get a sense for how well your filter is working.
- nailer 10y agoRad! You might be able to save a little time/logic by updating the JavaScript from ES3. Instead of: if(thisText.indexOf(thisWord) > -1) You can just do: if ( thisText.includes(thisWord) ) Likewise... for(let i = 0; i < entries.length; i++){ Can be replaced with: entries.forEach(function(entry, index){ Chrome supports both the relevant parts of ES6 and ES5 out of the box.
- alistproducer2 10y agothanks for the suggestions. I tend to avoid forEach because of the memory overhead (adds function calls where not really necessary). I guess I'm old school, but never got around to using includes. It's been on my radar for a while. I've always tried to write code that is as portable as possible, even though now, with evergreen browsers in the lead, it doesn't really matter as much.
- nailer 10y agoYeah, .forEach() is a new scope. But the better readability is worth the minor performance impact for everything but the most performance-intensive code.
- drenvuk 10y agoIt's that kind of thinking that gets us really slow software.
- nailer 10y ago"premature optimization is the root of all evil" - Don Knuth Also old-style for loops in JS fall victim to the last entry effect since people often use them to set up event handlers and wonder why they don't work.
- aryamaan 10y agoI would like to make an extension which sorts the stories based upon numbers of comments. How do I start? I have been working as a backend developer and completely agnostic about this stuff. TIA.
- alistproducer2 10y agoIf you check the code, contentScript.js:28 that line removes the meta data line, which contains the number of comments. One could easily parse the comment line and use it to rearrange the some, as opposed to deleting it. Fork the code and give it a try!