# RegEx help

**URL:** <https://discourse.pi-hole.net/t/regex-help/67120>\
**Category:** Help\
**Created:** [December 23, 2023, 9:52pm UTC](https://discourse.pi-hole.net/t/regex-help/67120 "2023-12-23T21:52:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zz\_Tt](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/zz_tt/32/39309_2.png) [@zz\_Tt](https://discourse.pi-hole.net/u/zz_Tt)\
**Post date:** [December 23, 2023, 9:52pm UTC](https://discourse.pi-hole.net/t/regex-help/67120/1 "2023-12-23T21:52:19Z")

</div>

I watch without ads on YouTube can I add this code to Pihole?

document.cookie="VISITOR\_INFO1\_LIVE=oKckVSqvaGw; path=/; domain=.youtube.com";window.location.reload();

in the browser, I want YouTube to be opened in the mobile version every time I log in, maybe please help.

---

<div class="post-metadata">

**Author:** ![chrislph](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/chrislph/32/32723_2.png) [@chrislph](https://discourse.pi-hole.net/u/chrislph)\
**Post date:** [December 23, 2023, 9:56pm UTC](https://discourse.pi-hole.net/t/regex-help/67120/2 "2023-12-23T21:56:01Z")

</div>

Pi-hole cannot block YouTube ads and doesn't interact with any site traffic at all. For this you will probably need some sort of browser extension/add-on. If your browser supports changing User Agent on a per-site basis you may be able to make it load the mobile version instead of the desktop version.

---

<div class="post-metadata">

**Author:** ![zz\_Tt](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/zz_tt/32/39309_2.png) [@zz\_Tt](https://discourse.pi-hole.net/u/zz_Tt)\
**Post date:** [December 23, 2023, 10:11pm UTC](https://discourse.pi-hole.net/t/regex-help/67120/3 "2023-12-23T22:11:01Z")

</div>

first of all, thanks for your really quick comment.

i'm in the browser with this code; I can also add chrome with the (ctrl shift j) keys, and YouTube switches to the mobile version and I don't see any ads. my goal is to add the code to pihole and I want it to open automatically when I enter YouTube from the browser on my linux tv.

---

<div class="post-metadata">

**Author:** ![chrislph](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/chrislph/32/32723_2.png) [@chrislph](https://discourse.pi-hole.net/u/chrislph)\
**Post date:** [December 23, 2023, 10:27pm UTC](https://discourse.pi-hole.net/t/regex-help/67120/4 "2023-12-23T22:27:19Z")

</div>

> [@zz\_Tt](#):
>
> my goal is to add the code to pihole

Pi-hole is just blocking or resolving domain names. It cannot affect how applications interact with the addresses that it resolves. It is not involved in that part at all.

---

<div class="post-metadata">

**Author:** ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)\
**Post date:** [December 23, 2023, 11:04pm UTC](https://discourse.pi-hole.net/t/regex-help/67120/5 "2023-12-23T23:04:26Z")

</div>

> [@zz\_Tt](#):
>
> can I add this code to Pihole?
> 
> document.cookie="VISITOR\_INFO1\_LIVE=oKckVSqvaGw; path=/; domain=.youtube.com";window.location.reload();

No. Pi-hole is a domain blocker. All it sees is queries for domains. It has no visibility into cookies, paths on a URL, javascript elements that are loaded, etc.

> [@zz\_Tt](#):
>
> my goal is to add the code to pihole and I want it to open automatically when I enter YouTube from the browser on my linux tv.

Pi-hole is not a web browser, so you can't add this code to Pi-hole and have it change the behavior of your Linux TV browser.

---

<div class="post-metadata">

**Author:** ![zz\_Tt](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/zz_tt/32/39309_2.png) [@zz\_Tt](https://discourse.pi-hole.net/u/zz_Tt)\
**Post date:** [December 24, 2023, 10:19am UTC](https://discourse.pi-hole.net/t/regex-help/67120/6 "2023-12-24T10:19:43Z")

</div>

Thanks for the replies. Maybe one day a new way will be found to block YouTube ads. Until then, keep it up.

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [January 14, 2024, 10:19am UTC](https://discourse.pi-hole.net/t/regex-help/67120/7 "2024-01-14T10:19:48Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
