https://github.com/elmoiv/pyads
Simple ad blocker using the hosts file.
https://github.com/elmoiv/pyads
adblock adblock-list adblocker adblocking ads advertisement advertising blocker hosts hostsfile
Last synced: 6 months ago
JSON representation
Simple ad blocker using the hosts file.
- Host: GitHub
- URL: https://github.com/elmoiv/pyads
- Owner: elmoiv
- License: gpl-3.0
- Created: 2019-04-08T15:57:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-13T10:56:34.000Z (almost 7 years ago)
- Last Synced: 2025-03-26T04:41:27.400Z (about 1 year ago)
- Topics: adblock, adblock-list, adblocker, adblocking, ads, advertisement, advertising, blocker, hosts, hostsfile
- Language: Python
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyAds
Simple ad blocker using the hosts file.
# Features
- You can block as many ad providers as you want.
- Your cat can use this code.
# How to Use
```
import pyads
adblock = pyads.Adblock(hostDic, hostSrc)
adblock.parseHosts(adblock.getHosts())
```
- _hostDic_ : Location of the system hosts file.
- _hostSrc_ : List, tuple or set containing urls with hosts raw data _see [test.py](test.py)_.
- if you want to revert the hosts file back:
```
adblock.cleanHosts()
```
*MUST RUN THIS SCRIPT WITH ADMIN PRIVILEGES*