Ad Block and yotube watching history

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
Ednan
DD-WRT Novice


Joined: 06 Sep 2011
Posts: 8

PostPosted: Sun Nov 27, 2022 15:59    Post subject: Ad Block and yotube watching history Reply with quote
Looking for one way to block Ad's with my 1043nd V2 (8mb flash), i find some ways.
For 8mb version DD-Wrt-r50927, dont have native "curl" as described on forum https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=313987&postdays=0&postorder=asc&start=30
And wget dont acess https.

But at end, i stay with the simpler way fom https://github.com/AnielShri/ddwrt-adblocker

Usage
Copy the startup code below to your Administration -> Commands and Save Startup. This will create a custom script to download a blacklist and add the domains to the dnsmasq.

In Services -> Services -> Enable DNSMasq

In Setup -> Basic Setup -> Enable Forced DNS Redirection (optional)

To enable weekly updates, in Administration -> Management -> Cron -> Additional Cron Jobs add:
Code:
0 11 * * 3 root /tmp/custom.sh



Startup code
Code:
# wait for the rest of the services to startup
sleep 20

# Create script to download blacklist
echo '#!/bin/sh

logger Starting blockads scripts

# clean up old list
rm /tmp/adhosts

# get new list
wget -qO- http://sbc.io/hosts/hosts | grep "^0.0.0.0" > /tmp/adhosts;
 
# restart service
killall dnsmasq
dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.conf

logger Finished executing blockads script' >> /tmp/custom.sh;

# add executable right
chmod +x /tmp/custom.sh

# add blacklist to dnsmasq
grep "addn-hosts=/tmp/adhosts" /tmp/dnsmasq.conf || echo "addn-hosts=/tmp/adhosts" >> /tmp/dnsmasq.conf;

# execute script
/tmp/custom.sh



I Loved this way. But had some problems with yotube watching history.
With some more time i find that line on StevenBlack/hosts:
Code:
0.0.0.0 s.youtube.com  # Blocking this will interfere with video watching history


So, i added on my setup code:
Code:
| grep -v "^0.0.0.0 s.youtube.com"

Endind like this:
Code:
# wait for the rest of the services to startup
sleep 20

# Create script to download blacklist
echo '#!/bin/sh

logger Starting blockads scripts

# clean up old list
rm /tmp/adhosts

# get new list
wget -qO- http://sbc.io/hosts/hosts | grep "^0.0.0.0" | grep -v "^0.0.0.0 s.youtube.com" > /tmp/adhosts;
 
# restart service
killall dnsmasq
dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.conf

logger Finished executing blockads script' >> /tmp/custom.sh;

# add executable right
chmod +x /tmp/custom.sh

# add blacklist to dnsmasq
grep "addn-hosts=/tmp/adhosts" /tmp/dnsmasq.conf || echo "addn-hosts=/tmp/adhosts" >> /tmp/dnsmasq.conf;

# execute script
/tmp/custom.sh



And, my Dnsmasq Infrastructure, i put in Additional Options:
Code:
no-resolv
bogus-priv
domain-needed
server=8.8.8.8
server=8.8.4.4
server=2001:4860:4860::8888
server=2001:4860:4860::8844
addn-hosts=/tmp/adhosts


Hope I've helped.


Last edited by Ednan on Mon Nov 28, 2022 20:55; edited 1 time in total
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6435
Location: UK, London, just across the river..

PostPosted: Sun Nov 27, 2022 19:09    Post subject: Reply with quote
To be honest there are many adblocking solutions around..some of those very old...some very complex...
The only thing you must check with those is, the output of netstat -npl if you have something different in the top line source / destination than 0.0.0.0 than those adblock's could be bad...
Using some of those adblockers ive found, they fetch the first address from the block list as a source domain name...

Im also using ad-blocker very simple one using wget and its ok with this..but not all adblockers can block youtube adverts like you believe...the best way is to use a browser add-on called 'uBlock Origin'

or Google search ddwrt Adblock or ad-block or similar..

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55779 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Ednan
DD-WRT Novice


Joined: 06 Sep 2011
Posts: 8

PostPosted: Sun Nov 27, 2022 20:09    Post subject: Reply with quote
Alozaros wrote:
[...]Im also using ad-blocker very simple one using wget and its ok with this..but not all adblockers can block youtube adverts like you believe...the best way is to use a browser add-on called 'uBlock Origin'

The intente is block majory of ad's on browser and apps in my family smartphones and tablets.
For youtube, DNS Ad-block dont work well. And plus, this method used StevenBlack HostList, an big and thrustfull source. But he indeed block youtube watching history; so i shared this method in forum with add to remove this little problem.

For youtube Ad's, i use Vanced Youtube on smartphone, SmartTubeNext for my BoxTV and uBlock for my PC Browser.

_________________
Atheros
TP-Link WR1043NDv2 -DD-WRT 50927 Gateway,DHCP,DNS,Ad-Block,Firewall,AP(2,4Ghz)
TP-Link Archer C5(w) v4 - CWMP,Dumb-AP(2.4Ghz+5Ghz)
------------------------------------------------------

Simple Ad-Block guide
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum