vimb icon indicating copy to clipboard operation
vimb copied to clipboard

Allow addblocking via webextension

Open fanglingsu opened this issue 8 years ago • 7 comments

It would be nice to allow the user to block requests based on a blacklist of regular expressions. I think for a first attempt it's enought to follow the blacklisting approach. The blacklist could be one or more files in $XDG_CONFIG_HOME/vimb[/PROFILE]/adblock/*-blacklist (*-whitelist might be useful in future too) that contains the regular expressions applied to the requested URIs, one per line. Then we must give the path to the directory to the webextension so that the extension can load it.

fanglingsu avatar Jul 19 '17 21:07 fanglingsu

I think this could be done more effectively by a proxy like Polipo, see http://rightfootin.blogspot.ca/2009/11/ad-blocking-with-polipo.html

devlinzed avatar Jul 24 '17 13:07 devlinzed

@devlinzed I had used privoxy for filtering in the past. But by the nature of proxies these can't filter content/requests over secure connection like https (except of host only pattern). So there is a real use case to do the filtering in the browser.

fanglingsu avatar Jul 24 '17 20:07 fanglingsu

Ok, I wrote this little script for lariza browser. It downloads the three biggest list and but it in one file. This with a cronjob, or on every start will create a good list.

#!/bin/bash

cd ~/.config/lariza/ 

wget -O 1.txt https://easylist-downloads.adblockplus.org/easylist.txt
wget -O 2.txt https://raw.githubusercontent.com/zpacman/Blockzilla/master/Blockzilla.txt
wget -O 3.txt https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt

cat 1.txt > adblock.black
cat 2.txt >> adblock.black
cat 3.txt >> adblock.black

rm 1.txt
rm 2.txt
rm 3.txt

ghost avatar Aug 03 '17 04:08 ghost

@beli3ver Thank you for the script. But as I can see lariza uses regex balcklisting for requested URL. So I think there is a lot of stuff that can be removed from the lists because it's special syntax for adblock like the following.

@@||phncdn.com/www-static/js/widgets-rating-like-fav.js$script

fanglingsu avatar Aug 04 '17 19:08 fanglingsu

This works with vimb https://github.com/jun7/wyebadblock

Maybe it can be integrated/improved for vimb.

Docbroke avatar Jan 17 '18 12:01 Docbroke

I did implement it like this after installing wyebadblock (from above link)

sudo ln -s /lib/wyebrowser/adblock.so /lib/vimb

vimb_adblock

#!/bin/sh
notify-send --urgency=normal "updating adblock" 
wget https://easylist.to/easylist/easylist.txt -O .config/wyebadblock/easylist.txt && notify-send --urgency=normal "adblock update done"

in vimb config file

nmap <C-U> :sh! vimb_adblock<CR>

Docbroke avatar Feb 22 '18 05:02 Docbroke

Hello. I hope it's okay that I'm hijacking this rather old thread. I'm working on an improved alternative to wyebadblock that supports dynamic cosmetic filtering, automatic filter lists updating, simple GUI and element picker/zapper. Everything seems to be working fine, but I would love to hear some feedback from vimb users. Thank you! https://github.com/dudik/blockit

dudik avatar Apr 14 '21 18:04 dudik