GithubHelp home page GithubHelp logo

kboghdady / youtube_ads_4_pi-hole Goto Github PK

View Code? Open in Web Editor NEW
2.4K 89.0 264.0 2.64 MB

YouTube script to add the new Ads list for Pi-hole

Shell 100.00%
pihole pihole-blocklists pihole-youtube-ads youtube youtube-ads pihole-ads-list pi-hole blacklist adguard adguardyoutube

youtube_ads_4_pi-hole's Introduction

Blocking status ✅ --Blocking Working good )
Buy me a coffee via paypal paypal

Buy me Coffee with XLM GDQP2KPQGKIHYJGXNUIYOMHARUARCA7DJT5FO2FFOOKY3B2WSQHG4W37
Buy me Coffee with BitCoin 36fD957SDWHJYYzuH2xmceJ6T2qE9vNiV4
Buy me Coffee with XRP rw2ciyaNshpHe7bCHo4bRWq6pqqynnWKQg
Buy me Coffee with BAT 0xb9f4845dbEd1FB1Dae90D8e203037B5623B66666
Buy me Coffee with XMR
46RGtwR2gS3UsjCtmzX7mGAXsXj6ui4ZbiwRhbeMuB7jHYUHhxot5JgRVwVT3dpnQqRk9qsd4N6NXhsjREKhfMmCUTMffLq

Script to add YouTube Ads DNS to Pi-hole black list

You can add this link to your gravity list by going to

http://piholeIPAddress/admin/groups-adlists.php
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/youtubelist.txt

and the list added by the crowed Keep in mind the crowd list it is all DNS gathered by the crowd WITHOUT filtering the block DNS
https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/crowed_list.txt

Also, add script to update the gravity list containing these lines : pihole -g sudo pihole restartdns if you experience youtube loops or blocking to the actual video while using the gravity
Please clear the gravity domain list as it sometimes keep the ignore list :

/usr/bin/sqlite3 /etc/pihole/gravity.db "delete from gravity where domain like '%googlevideo.com%' "
pihole -g

How the script works

  • It will get the black.list from my github which is updated daily or every two days
  • It will update both the black.list and blacklist.txt files where the blocking of pihole happens
  • It will remove any dupiclates

it will be more effective if you add it the crontab

Steps:

1- Download the script from github using this command :

git clone https://github.com/kboghdady/youTube_ads_4_pi-hole.git
cd youTube_ads_4_pi-hole

2- Change where the repo directory in youtube.sh

repoDir='/pi/youTube_ads_4_pi-hole'

3- Make the script executable

sudo chmod a+x youtube.sh

4- Create a scheduled task to run the script:

sudo crontab -e 

5-Add this line to make it runs every 1 hour, but you can change it to whatever you like

0 */1 * * * sudo /home/pi/youTube_ads_4_pi-hole/youtube.sh >/dev/null 

Where the script location is /home/pi/youTube_ads_4_pi-hole/youtube.sh
more information about crontab https://crontab.guru

if you want to delete all blacklist from your database in case of issues

/usr/bin/sqlite3 /etc/pihole/gravity.db "delete from domainlist where domain like '%googlevideo.com%' "

NOTE : if you are using the default pihole gravity make sure to whitelit s.youtube.com which blocks the videos

this default list has it : https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

youtube_ads_4_pi-hole's People

Contributors

bromeroarbelaez avatar denizdogan avatar jamido avatar kboghdady avatar naltun avatar pjg avatar techroy23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube_ads_4_pi-hole's Issues

Ads country-specific?

I have tried this list for about a week now. Hard to say whether it’s working or not but one thing is for sure, the only ads I am seeing right now is country-specific. I only see ads in my native language. Just want to let you know. Maybe a domain change will do it?

lots of sites missing

https://www.rtsak.com/cidr/2001:998::-30

IP Type Hostname
2001:998:12:59::c A r1.sn-xap5-ixaz.googlevideo.com
2001:998:12:59::c A r1---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::d A r2---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::e A r3.sn-xap5-ixaz.googlevideo.com
2001:998:12:59::e A r3---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::f A r4.sn-xap5-ixaz.googlevideo.com
2001:998:12:59::f A r4---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::10 A r5---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::11 A r6---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::12 A r7---sn-xap5-ixaz.googlevideo.com
2001:998:12:59::13 A r8.sn-xap5-ixaz.googlevideo.com
2001:998:12:59::13 A r8---sn-xap5-ixaz.googlevideo.com
2001:998:12:5a::c A r1---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::d A r2---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::d A r2.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::e A r3---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::e A r3.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::f A r4.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::f A r4.sn-xap5-ixas.c.pack.google.com
2001:998:12:5a::f A r4---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::10 A r5.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::10 A r5---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::11 A r6---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::11 A r6.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::12 A r7---sn-xap5-ixas.googlevideo.com
2001:998:12:5a::13 A r8.sn-xap5-ixas.googlevideo.com
2001:998:12:5a::13 A r8---sn-xap5-ixas.googlevideo.com
2001:998:12:5b::c A r1---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::c A r1.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::d A r2.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::e A r3---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::e A r3.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::f A r4---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::f A r4.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::10 A r5---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::10 A r5.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::11 A r6.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::11 A r6---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::12 A r7---sn-xap5-ixal.googlevideo.com
2001:998:12:5b::12 A r7.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::13 A r8.sn-xap5-ixal.googlevideo.com
2001:998:12:5b::13 A r8---sn-xap5-ixal.googlevideo.com
2001:998:12:9a::c A r1.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::d A r2.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::e A r3.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::10 A r5.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::11 A r6.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::12 A r7.sn-xap5-ixa6.googlevideo.com
2001:998:12:9a::13 A r8.sn-xap5-ixa6.googlevideo.com

f.e.

Is there anyway to add these?

I'm having like these turn up, is there anyway you could add them to your script please ?

p2-galfbu4g6o4ms-recvcqnkwlxh4nur-868998-i1-v6exp3.ds.metric.gstatic.com
p2-galfbu4g6o4ms-recvcqnkwlxh4nur-868998-s1-v6exp3-v4.metric.gstatic.com
p2-galfbu4g6o4ms-recvcqnkwlxh4nur-if-v6exp3-v4.metric.gstatic.com
p2-nfj5wqfccwaig-u32h7kfqb55lkgxx-755042-i1-v6exp3.ds.metric.gstatic.com
p2-nfj5wqfccwaig-u32h7kfqb55lkgxx-755042-i2-v6exp3.v4.metric.gstatic.com
p2-nfj5wqfccwaig-u32h7kfqb55lkgxx-755042-s1-v6exp3-v4.metric.gstatic.com
p4-b26d2myvxmnic-2g7erssxpeljycve-if-v6exp3-v4.metric.gstatic.com
p4-dtpyky5z34ncy-kpslgygro46fb7mf-if-v6exp3-v4.metric.gstatic.com

127.0.0.1

Hi. Can you please create a black.list file with 127.0.0.1 at the beginning of each line? I know that this can be done with scripts, but I'm not familiar with linux. I want to add this file to my router's openwrt hosts file.
Thank you!

filtter youtube links from existing local pihole log

Hello kboghdady, thanks for your expert guidance. i am running your "youtube.sh" bash command daily. as you are expert in programming i want to suggest one more thing to add in your bash file. like system check the logs of local pihole data & filter "http: //r3---sn-uxa0n-ttjse.googlevideo. com" like address & in next circle that address also append in your blacklist.txt.

the overall mean that today from which link i received youtube adds. tomorrow after re-run your program it will detain & closed for future. my overall mean is not to upload our data to your side. but like in our blacklist.txt file. also i am using pihole & unbound combination & in each of my google link"uxa0n" always present. but when i fetch google video data or your file "curl ‘https: //api.hackertarget.com/hostsearch/?q=googlevideo.com" i am not see much these "uxa0n" links. so i am confusing. why this "uxa0n" is coming in my side. thanks in advance

Error running script

Hi kboghdady,
thank you for your effort. I have problem with running script, I get this error:

pi@raspberrypi:~/youTube_ads_4_pi-hole $ sudo ./youtube.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 757k 100 757k 0 0 1131k 0 --:--:-- --:--:-- --:--:-- 1131k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 757k 100 757k 0 0 1386k 0 --:--:-- --:--:-- --:--:-- 1389k
sudo: unable to execute /usr/local/bin/pihole: Argument list too long

can you help me what's wrong?
Thank you,
Pavel

youTube_ads_4_pi-hole breaks youtube

Hi,

Thanks for this script. I tried it for a while but unfortunately it looks like it ended breaking YT completely. Videos would simply not load anymore. I ended up removing the script but it seems like the script bans too many domains, or at least some domains that deliver actual content.

Sorry not really any more details to add!

Some Legitimate Videos Blocked

After implementing the blacklists I'm seeing some legitimate videos being blocked, the YouTube videos simply wont begin playing, witnessed on both a Roku TV Stick and on a Win7 Desktop. Most videos play fine but some do not.

I'm in the UK if that is of any relevance.

no black.list or blacklist file in the folder

Howdy!

I am trying to use your script, however in the /etc/pihole/ folder I did not find black.list or blacklist file, the only file seems to be relevant to the ads list is called adlists.list. Will that affect the usage of the script? The pi-hole version is 4.3.2 (latest). Thank you in advance!

Ads still playing in browser and app (Android)

Hi, I've recently setup a pi-hole on my network and added your list under "Adlist group management". I updated the gravity list, but YouTube ads are still playing on my Android device through the app and browser. Pi-hole seems to be working fine as it is blocking ads from other sites. Did I add your list correctly?

I'm in the United States, if that helps.

Unraid

Do you know how to get this to work in unraid?

Initial Run

Is it normal for the first run of the script to take ages? Is the first run the slowest and then subsequent runs then a lot faster?

Admitedly I know I'm running on it on a slow system (Raspberry Pi B from 2011 - 700MHz CPU) but it seems to run DietPi + PiHole nicely.

It has been running for close to an hour now, I cancelled it a while ago because I convinced myself it had got in a never ending loop, however after re-running I don't think that was the case because now I'm seeing lots of "... already exists in blacklist, no need to add!" so I'm guessing I've only slow things down.

I'd be intregued to know the answer to my question at the top though.

Thanks for all of your time and efforts on this wonderful project.

Video won't to start

Hey, is it possible that the video no longer shows advertisements but does not start the video? It's stuck in an endless loop. It seems to me a lot

Working Blocklist entry

Hello!

Just a suggestion,

using the script to add the blacklist to '/etc/pihole' causes the gui to chug. My preferred method is to add a url to the blocklist.

Adding the url in your instructions...

https://github.com/kboghdady/youTube_ads_4_pi-hole/blob/master/youtubelist.txt

Doesn't get me the list.

However, adding the url you curl in your script...

https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/black.list

Successfully pulls the list and updates gravity!

Videos won't start

Hi ! Thanks for your job.

Videos won't start/nor autoplay until I restart the video itself.. .

How to fix that or remove all entries from the blocklist after running your script for months?

Thanks a lot.

Update daily on repo ?

Could we add a system to send updated lists of people using the solution to this repo? In order to have daily updated lists available?

Not working anymore!

Getting anoying, youtube black screens, videos not loading you need to go back or refresh ads still going tru! If the issue cannot be roleved please provide an easy way to uninstall/remove!

gravity.db

SHould a
pihole -g
be added to the script for V5.0 users?
Now the updated black.list wont get into the gravity.db

autoinstall gawk

What about adding "-y" to autoinstall gawk on at the end of line 37 on youtube.sh ?

Merge error in blacklist file and youtube.sh

Hi,

there is a merge error in your blacklist file on line 20102:

<<<<<<< HEAD

Also there is a "====" command on line 21 of the youtube.sh script which does nothing, except throw an "unknown command" error.

How do you create the list?

Hi.

I have a guess that your list works for US mostly. Because as soos as I switch my youtube location and languege to US, I get much less ads than when Im "located" in Russia.

Could you please share the way you create the list? Then I will be able to create a Russian version for myself and finally get rid of ads.

Thanks

Syntax error

The script doesn't work on my Raspi3 running Pihole:

pi@pihole3:~ $ sudo python /home/pi/youtube.sh File "/home/pi/youtube.sh", line 9 piholeIPV4=hostname -I |awk '{print $1}' ^ SyntaxError: invalid syntax

Anything except gawk that needs to be installed?

False Positive

Video doesn't play when r5---sn-vgqsknll.googlevideo.com is blocked

"Database Is Locked"

Upon running the script manually I am constantly greeted with "Error: database is locked" after it attempts to add any domain to the black list.

The image attached is an example of my issue:

image

Loading until infinity

My PiHole is blocking the advertisements but when my YouTube player hits the add block within a video it stops playing and starts loading the advertisement until the end of time.

Samsung TV Q60R YouTube Application.

Can't open blacklist

Hey mate, loving the script, however I think it's so large it causes the pihole admin to freeze if I try and load the blacklist

Anyone else have this issue? Any work arounds?

I don't like the way this is implemented.

I do not think so the way you implement the way of importing the domains to pi hole appropriate. Where you import each domain separately. I tried this other way by using pihole5-list-tool. I could easily import a bulk of lists as white lists or as blacklists. I do not understand this approach of yours to import the domains one by one. This is very time consuming and also annoying to disable. Could I know why you take such an approach? Is there any reason?

after longer usage of script youtube stops to open videos

after several days of using script I have noticed that videos aren't launching. I commented section for analysing the logs and left downloading blacklists only and rebuild blacklist. Videos started to work fine. So section for analysing the logs needs some readjustments ;-) Nevertheless I appreciate the idea :-)

Transform list to valid blocklist

If you have black.list transform to a valid (Pi-hole) blacklist like https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts, users would only need to add it under their-pi-hole-ip/settings.php?tab=blocklists.

It is very cumbersome to have users set a cronjob and add EVERYTHING you have to their own 'personal' Blacklist menu.

If you transform the file yourself before you push a commit, users only have to add https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/black.list to the Settings menu, press Save and Update and BAM, Pi-hole does the rest (including the auto-update from your GitHub repo):

image

How to incorporate this list in gravity in pie hole

we have this list in local raspberry pi but when i am adding /home/pi/youTube_ads_4_pi-hole/black.list it is showing following error.

[i] Target: local (black.list)
[✗] Status: Connection Refused
[✗] List download failed: no cached list available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.