Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/akira02/Kemono_Adblocker

Replace Advertisements with Kenomo Friends picture Using Perceptual Techniques
https://github.com/akira02/Kemono_Adblocker

Last synced: 2 months ago
JSON representation

Replace Advertisements with Kenomo Friends picture Using Perceptual Techniques

Lists

README

        

# Kenomo Ad Blocker

![2017-04-24 11 18 46](https://cloud.githubusercontent.com/assets/4176802/25344497/e3dd3cec-2944-11e7-91af-0266a32800b1.png)

This extension is a perceptual ad blocker which replace advertisements with Kenomo Friends pictures on
Facebook and Adchoices advertisements across the web.

All Kenomo Friends pictures are from offical Twitter.

For Facebook ad detection, it finds newsfeed items by looking for containers within the given width constraints and border on the side; it looks for the sidebar ads by searching for containers with the proper size constraints in a sidebar. It then determines which newsfeed items are ads by searching for the "Sponsored" link within them and checking whether this link ultimately goes to the Facebook "about ads" page.

For Adchoices detection, it runs a content script in every iframe which searches all of the images,
(those explicit in an img element, those in the background-image css, and
those drawn as an svg) and then uses fuzzy hashing to compare them to example
Adchoices icons. If any of the images match, it highlights the iframe as
an advertisement.

# Code Overview

- *manifest.json* contains information about the overall structure of the extension as well as the title, version number, and description.
- *popup* is just a simple description of the extension that appears when the user clicks the icon in the upper right.
- *ad_highlighter.js* is the script that runs on facebook.com, searches for ads, and highlights them.
- *content.js* is the script that runs in iframes, searches for Adchoices images
and highlights the iframes if the Adchoices icon is found.
- *perceptualLibrary/link_clicker.js* contain the code that determines the ultimate result destination of clicking a link.
- *perceptualLibrary/container_finder.js* contains code that returns a list of containers conforming to various constraints, including width/height bounds or specific css properties but also more high-level things like whether the container is a sidebar or not.
- *perceptualLibrary/imageSearch.js* contains the perceptual code for detecting images of various kinds.
- *perceptualLibrary/check_text_and_link* contains code that searches for text and a link within a given container.
- *perceptualLibrary/adchoices_hashes.js* contains the hashes of adchoices icons to match.
- *perceptualLibrary/hash_encoding.js* contains the code that converts from the adchoices hashes (in hex) to binary.
- *perceptualLibrary/perceptual_background.js* contains the code that does the fuzzy image hashing and link destination detection.
- *locale_info.js* keeps information about the "Sponsored" text in various languages to support all Facebook locales.
- *utils.js* contains the code for covering advertisements once they have been identified
- *externalCode* contains jquery 1.12.4
- *actual_icons* contains the actual Adchoices icons.

# Running This Extension

To get this running from the source code on your local machine (Chrome only):

- navigate to "chrome://extensions"
- click the checkbox next to "Developer mode" in the upper right hand corner
- click the "Load unpacked extension..." button below the "Extensions" title
- select the “perceptual-adblocker” folder from your filesystem
- refresh any open Facebook pages

# Old ver. screenshot

![2017-04-19 12 06 03](https://cloud.githubusercontent.com/assets/4176802/25141481/42e79ac4-2496-11e7-9822-f277378b5c9a.png)

### License:
MIT