Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Block youtube ADs with PiHole blacklist

    Scheduled Pinned Locked Moved pfBlockerNG
    16 Posts 8 Posters 19.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • w0wW
      w0w
      last edited by w0w

      DNSBL->DNSBL Groups create NEW group

      b2594a07-bda0-4f1c-a691-90f9030316c5-изображение.png

      Use https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/youtubelist.txt
      as source, got it from https://github.com/kboghdady/youTube_ads_4_pi-hole
      Reload pfBlockerNG, try some browser and open Youtube.

      P.S. Works fine on the different browsers but not on the android Youtube app.
      Edited, URL fixed, thanks provels

      provelsP 1 Reply Last reply Reply Quote 2
      • provelsP
        provels @w0w
        last edited by provels

        @w0w
        I'll have to try that. Not pfSense related and not spam, but I've found a YouTube player app that works for ad blocking on Android, SmartTubeNext. It works on my TV box, but that's the only Android I have.

        Be sure to use the

        https://raw.githubusercontent.com/kboghdady/youTube_ads_4_pi-hole/master/youtubelist.txt
        

        source.

        Peder

        MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
        BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

        1 Reply Last reply Reply Quote 0
        • M
          MoonKnight
          last edited by

          Not bad, but uBlock Origin is still the best out there for ad-blocking :)

          --- 24.11 ---
          Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz
          Kingston DDR4 2666MHz 16GB ECC
          2 x HyperX Fury SSD 120GB (ZFS-mirror)
          2 x Intel i210 (ports)
          4 x Intel i350 (ports)

          1 Reply Last reply Reply Quote 0
          • provelsP
            provels
            last edited by

            I tried this and watched a couple videos, then the "Video will play after ad" appeared. No expert here.

            Peder

            MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
            BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

            w0wW 1 Reply Last reply Reply Quote 0
            • w0wW
              w0w @provels
              last edited by

              @provels
              I think there are some DNS records are missing in the list or google updates them dynamically. So yes, sometimes it fails to block ads, but mostly it works.
              I've found some python regex list for PiHole, but it does not work correctly for me, videos just refused to load.

              1 Reply Last reply Reply Quote 0
              • Cool_CoronaC
                Cool_Corona
                last edited by

                Why not use an adblocker in the browser instead??

                Or use the lists from there?

                bingo600B w0wW 2 Replies Last reply Reply Quote 0
                • bingo600B
                  bingo600 @Cool_Corona
                  last edited by bingo600

                  @cool_corona
                  I have experienced that sites can detect the adblocker running in the browser.
                  And some sites are not happy.

                  But the most important reason i use pi-hole, is that it is "site (vlan) wide".
                  No need for adblocker or ....
                  And i can add my own blocks easily.

                  /Bingo

                  If you find my answer useful - Please give the post a 👍 - "thumbs up"

                  pfSense+ 23.05.1 (ZFS)

                  QOTOM-Q355G4 Quad Lan.
                  CPU  : Core i5 5250U, Ram : 8GB Kingston DDR3LV 1600
                  LAN  : 4 x Intel 211, Disk  : 240G SAMSUNG MZ7L3240HCHQ SSD

                  1 Reply Last reply Reply Quote 0
                  • AndyRHA
                    AndyRH
                    last edited by

                    For me it broke YouTube. Videos that start with an add never play. Had to remove the list.
                    😧

                    o||||o
                    7100-1u

                    provelsP 1 Reply Last reply Reply Quote 0
                    • w0wW
                      w0w @Cool_Corona
                      last edited by

                      @cool_corona
                      Sometimes it's not possible. You just can't force user to use it.

                      JeGrJ 1 Reply Last reply Reply Quote 0
                      • JeGrJ
                        JeGr LAYER 8 Moderator @w0w
                        last edited by

                        @w0w Do you use that list on anything that is not a browser client?

                        Had such a list in PiHole and used it on Chromecasts, Android TVs etc. and no device with a YouTube App worked anymore as the preroll Ads won't show and the actual video doesn't get triggered then. Even looking at 2min black screen it doesn't skip to the video. Was the same as @AndyRH and had to remove the list for the TVs and FireTVs as neither did work (yes of course a few videos get played when there's no ads/monetization on them, but most do today).

                        Cheers

                        Don't forget to upvote 👍 those who kindly offered their time and brainpower to help you!

                        If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

                        w0wW 1 Reply Last reply Reply Quote 0
                        • w0wW
                          w0w @JeGr
                          last edited by

                          @jegr
                          it still showing Ads and videos on the Youtube App on all android devices I have tried. But if I use any android browser client instead of app, no more Ads displayed on the Youtube.
                          Don't know maybe Google uses same servers for streaming Ads and videos in different countries or maybe some other settings in pfBlockerNG have been changed. My Whitelist contains

                          s3.amazonaws.com
                          s3-1.amazonaws.com # CNAME for (s3.amazonaws.com)
                          .github.com
                          .githubusercontent.com 
                          github.map.fastly.net # CNAME for (raw.githubusercontent.com)
                          .gitlab.com
                          .apple.com 
                          .sourceforge.net
                          .fls-na.amazon.com # alexa
                          .control.kochava.com # alexa 2
                          .device-metrics-us-2.amazon.com # alexa 3
                          .amazon-adsystem.com # amazon app ads
                          .px.moatads.com # amazon app 2
                          .wildcard.moatads.com.edgekey.net # CNAME for (px.moatads.com)
                          .e13136.g.akamaiedge.net # CNAME for (px.moatads.com)
                          .secure-gl.imrworldwide.com # amazon app 3
                          .pixel.adsafeprotected.com # amazon app 4
                          .anycast.pixel.adsafeprotected.com # CNAME for (pixel.adsafeprotected.com)
                          .bs.serving-sys.com # amazon app 5
                          .bs.eyeblaster.akadns.net # CNAME for (bs.serving-sys.com)
                          .bsla.eyeblaster.akadns.net # CNAME for (bs.serving-sys.com)
                          .adsafeprotected.com # amazon app 6
                          .anycast.static.adsafeprotected.com # CNAME for (static.adsafeprotected.com)
                          google.com
                          www.google.com
                          youtube.com
                          www.youtube.com
                          s.youtube.com
                          youtube-ui.l.google.com # CNAME for (youtube.com)
                          stackoverflow.com
                          www.stackoverflow.com
                          dropbox.com
                          www.dropbox.com
                          www.dropbox-dns.com # CNAME for (dropbox.com)
                          .adsafeprotected.com
                          control.kochava.com
                          secure-gl.imrworldwide.com
                          pbs.twimg.com # twitter images
                          www.pbs.twimg.com # twitter images
                          cs196.wac.edgecastcdn.net # CNAME for (pbs.twimg.com)
                          cs2-wac.apr-8315.edgecastdns.net # CNAME for (pbs.twimg.com)
                          cs2-wac-us.8315.ecdns.net # CNAME for (pbs.twimg.com)
                          cs45.wac.edgecastcdn.net # CNAME for (pbs.twimg.com)
                          

                          I think it is default. I've added only s.youtube.com entry, but it does not matter. It works the same way with or without it.

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            mcury @w0w
                            last edited by mcury

                            My android phone refuses to use the DNS server provided by the DHCP when using Youtube app..
                            Through firewall logs, I can see it using 8.8.8.8.. So it's bypassing DNSBL completely..

                            It seems that my chromecast is doing the same thing:

                            4dab3ef2-5ae8-4478-a513-549dc2aedbc5-image.png

                            dead on arrival, nowhere to be found.

                            w0wW 1 Reply Last reply Reply Quote 0
                            • w0wW
                              w0w @mcury
                              last edited by

                              @mcury
                              I've captured some packets and for me it looks like now Youtube App uses some version of DNS over HTTPS. I don't see public DNS server IPs in captured data

                              provelsP 1 Reply Last reply Reply Quote 0
                              • provelsP
                                provels @w0w
                                last edited by

                                @w0w
                                If that is the case, there DoH blocklists in pfBlockerNG. Or maybe I got them from GitHub, been a while.
                                https://raw.githubusercontent.com/oneoffdallas/dohservers/master/list.txt
                                https://raw.githubusercontent.com/Sekhan/TheGreatWall/master/TheGreatWall.txt
                                That, and setting a rule for all LAN DNS requests to loop back to the FW might work.

                                Peder

                                MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
                                BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

                                w0wW 1 Reply Last reply Reply Quote 0
                                • w0wW
                                  w0w @provels
                                  last edited by

                                  @provels
                                  Added both and now Youtube App never plays videos with Ads 😀

                                  1 Reply Last reply Reply Quote 1
                                  • provelsP
                                    provels @AndyRH
                                    last edited by

                                    @andyrh said in Block youtube ADs with PiHole blacklist:

                                    For me it broke YouTube. Videos that start with an add never play. Had to remove the list.
                                    😧

                                    Same for me. The DoH lists seem to be working fine, though.

                                    Peder

                                    MAIN - pfSense+ 24.11-RELEASE - Adlink MXE-5401, i7, 16 GB RAM, 64 GB SSD. 500 GB HDD for SyslogNG
                                    BACKUP - pfSense+ 23.01-RELEASE - Hyper-V Virtual Machine, Gen 1, 2 v-CPUs, 3 GB RAM, 8GB VHDX (Dynamic)

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.