forked from kboghdady/youTube_ads_4_pi-hole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoutube.sh
executable file
·38 lines (28 loc) · 1.14 KB
/
youtube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# Update the pihole list with youtube ads
# this shell script is made by Kiro
#Thank you for using it and enjoy
# The script will create a file with all the youtube ads found in hostsearch and from the logs of the Pi-hole
# it will append the list into a file called blacklist.txt'/etc/pihole/blacklist.txt'
piholeIPV4=$(hostname -I |awk '{print $1}')
piholeIPV6=$(hostname -I |awk '{print $2}')
blackListFile='/etc/pihole/black.list'
blacklist='/etc/pihole/blacklist.txt'
# Get the list from the GitHub
sudo curl 'https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/black.list'\
>>$blacklist
sudo curl 'https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/black.list'\
>>$blackListFile
wait
# check to see if gawk is installed. if not it will install it
dpkg -l | grep -qw gawk || sudo apt-get install gawk -y
wait
# remove the duplicate records in place
gawk -i inplace '!a[$0]++' $blackListFile
wait
gawk -i inplace '!a[$0]++' $blacklist
## adding it to the blacklist in Pihole V5
# only 200 Domains at once
sudo xargs -a $blacklist -L200 pihole -b -nr
# restart dns
sudo pihole restartdns