Youtube Ads Blocker 3.0 for Pihole 5.0

The brand new version of Pihole 5.0 has deleted the following files:


And has created for all these data a new SQLite3 database:


With this change, all the previous versions to 3.0 of the script that I made to block the YouTube Advertisement, has stopped working. So I have created a new version in order to handle that new SQLite database.

To install this new version you should follow the following steps:

  • Unistall the version previous to 3.0, executing:
./ uninstall
  • Download the new version from my Github and install:
git clone
cd ytadsblocker
chmod a+x
./ install

I highly recommend you to take a look into the documentation of this new version here since there are a lot of new changes.


Now the script will generate a group called: YTADSBLOCKER. This name must not be deleted, since it could lead the script to fail. You can check this in ‘Group Management -> Groups’

In ‘Group Management -> Domains’ you can check the new subdomains added by the script:

Finally, in ‘Group Management -> Clients’ you should assign the group YTDASBLOCKER to the clients that we want to block the access to these subdomains. By example:

That’s all, folks!

If I have helped you, you could support me inviting me to a coffee! that’s the best way to support me.

14 comentarios sobre “Youtube Ads Blocker 3.0 for Pihole 5.0

  1. Hi, thanks for sharing that, great job.
    I have a question. The scrip will update automatically the domain’s list to block? If yes, that meaning that the YTADSBLOCKER will “learn” and add the domains to block by itself? If not, so what I should do?
    I’ve just installed it and the first try on youtube it didn’t work, but I think is for my concerns above or it’s not? Thank you so much for your time.

    1. Hi there Giulio,

      Of course, once the script is running, its reading the pihole logs and searching for Googlevideo subdomains. If a Googlevideo subdomain appear, it is forwarded straight away to the SQLite database, so it basically mean that the subdomains are being blocked.

      Anyway, take into account, that you must start the script executing: systemctl start ytadsblocker
      If you’re running the script on a Docker container, you must execute as follow: ./ start &

      You can use: systemctl -l status ytadsblocker in order to check if the script is working properly. Or you can check the file /var/log/ytadsblocker.log.

      You must see some output like this:

      └──╼ #tail -f /var/log/ytadsblocker.log
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:
      [2020-11-19 20:16:32] Adding the subdomain:

      Kind regards,

  2. Hello,

    How do I install this on Mac for the pi-hole running on docker?

    Forgive my ignorance as I am not familiar with scripting and coding. I followed the steps but it doesn’t work. It doesn’t create YTADSBLOCKER, for example.


    1. Hi James, there’s already a version for Docker, did you use the latest version from my GitHub?

      In the Docker version you can’t use systemctl since this is not available by default, so you must install and execute as follows:
      ./ install
      ./ start

      1. Thank you for the prompt response. Below is the steps I’ve followed and the output.

        The /etc/pihole/, for example, doesn’t exist in my system. The ytadsblocker.log on the other than says the following:

        Error: unable to open database “/etc/pihole/gravity.db”: unable to open database file


        root@301f0cbe3c0a ~ # git clone
        Cloning into ‘ytadsblocker’…
        remote: Enumerating objects: 39, done.
        remote: Counting objects: 100% (39/39), done.
        remote: Compressing objects: 100% (39/39), done.
        remote: Total 148 (delta 20), reused 0 (delta 0), pack-reused 109
        Receiving objects: 100% (148/148), 58.50 KiB | 739.00 KiB/s, done.
        Resolving deltas: 100% (75/75), done.
        root@301f0cbe3c0a ~ # cd ytadsblocker
        root@301f0cbe3c0a ytadsblocker # chmod a+x
        root@301f0cbe3c0a ytadsblocker # ./ install
        whereis: illegal option — b
        usage: whereis program […]
        \e[31m__ ______ __ __________ ______ ______ ___ ____ _____
        \ \/ / __ \/ / / /_ __/ / / / __ )/ ____/ / | / __ \/ ___/
        \ / / / / / / / / / / / / / __ / __/ / /| | / / / /\__ \
        / / /_/ / /_/ / / / / /_/ / /_/ / /___ / ___ |/ /_/ /___/ /
        /_/\____/\____/ ____ \______________________ |_/_____//____/
        / __ )/ / / __ \/ ____/ //_// ____/ __ \
        / __ / / / / / / / / ,< / __/ / /_/ /
        / /_/ / /___/ /_/ / /___/ /| |/ /___/ _, _/
        /_____/_____/\____/\____/_/ |_/_____/_/ |_| v3.4\e[0m by @deividgdt

        [i] Youtube Ads Blocker: INSTALLING…
        [i] You can check the logs in: /var/log/ytadsblocker.log
        [i] All the subdomains will be added to the database: /etc/pihole/gravity.db
        [i] Every 240s it reads: /var/log/pihole.log

        [\e[32m✓\e[0m] root is a valid user.
        [i] If you move the script to a different place, please run it again with the option 'install'
        [i] Installing the service…./ line 74: cd: /lib/systemd/system: No such file or directory
        OK. Service installed.
        [i] Configuring the database: /etc/pihole/gravity.db …
        root@301f0cbe3c0a ytadsblocker # ./ start
        whereis: illegal option — b
        usage: whereis program […]
        [\e[32m✓\e[0m] root is a valid user.
        Youtube Ads Blocker Started
        Check the /var/log/ytadsblocker.log file to get further information.

        Thank you.

      2. After I installed the Docker Desktop, I used the following commands (via

        docker pull pihole/pihole

        then I edited and the used the following:

        docker run -d –name pihole -e ServerIP=your_IP_here -e TZ=time_zone_here -e WEBPASSWORD=Password -e DNS1= -e DNS2= -p 80:80 -p 53:53/tcp -p 53:53/udp -p 443:443 -v ~/pihole/:/etc/pihole/ –dns= –dns= –cap-add=NET_ADMIN –restart=unless-stopped pihole/pihole:latest

        I then directed the Mac’s DNS to and it started working. It seems that in my case database and pihole folder is under ~ so I do have a pihole folder under ~/pihole/.

    2. I think I’ve found my mistake. I was directly using the Mac’s terminal to install, which explains why it couldn’t find the pihole.

      I launched the CLI on Docker Desktop for pihole and followed the same steps. I can see the new group and subdomains being added to the blacklist.

      After typing ./ start, can I just close the terminal? I assume the script keeps working until I tell it to stop and it keeps updating the database so I don’t have to update gravity manually from the dashboard.

      1. Hi James,
        You must use an ampersand at the end of the command in order to let the script running on background.
        Something like this:
        ./ start &
        With that will be enough.

    1. Buenas Arry650,

      Es la misma, si. Simplemente traduje la entrada al inglés para que la pueda encontrar el público de habla inglesa.


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s