# How do I block ads on YouTube?

**URL:** https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253
**Category:** Help
**Tags:** blacklisting
**Created:** [October 19, 2016, 12:09am UTC](https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253 "2016-10-19T00:09:23Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![jacob.salmela](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jacob.salmela/32/8_2.png) [@jacob.salmela](https://discourse.pi-hole.net/u/jacob.salmela)
#### Post date: [January 7, 2017, 5:36am UTC](https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253/12 "2017-01-07T05:36:51Z")

</div>

Assuming your information is correct, I couldn't resist the scripting opportunity. Here is what I came up with to generate the list:

```auto
# Array of fingerprints
# Add new ones here and the script below will generate the list
fingerprints=(sn-8xgp1vo-xfgk
sn-8xgp1vo-xfge7
sn-p5qlsnll
sn-a5mekner
sn-vgqs7nez
sn-vgqs7n7k
sn-vgqsenes)

# For each fingerpint, 
for ((i = 0; i < "${#fingerprints[@]}"; i++)); do
  # Generate the list based on https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253/11?u=jacob.salmela
  echo r{1..20}---${fingerprints[$i]}.googlevideo.com
  echo r{1..20}.${fingerprints[$i]}.googlevideo.com
done

```

You can also continue to use the brace expansion to calculate every fingerprint possibility with something like this:

```auto
echo sn-{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}

```

which will run through every possibility from `sn-aaaaaaaa` to `sn-99999999`. I think...

Not sure if `dnsmasq` could even handle all of those :question:...

---

_[View the full topic](https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253)._
