16

I am getting really distracted by YouTube recently, but I still need access to YouTube videos. I inadvertently visit youtube.com, and I would like to block this page without blocking the whole site. Is there a uBlock filter that only works on the root page?

1
  • So you want to only block YT frontpage "youtube.com" and be able to access all other YT pages? It appears that the given ||youtube.com^$document filter blocks youtube.com completely.
    – user198350
    Sep 4, 2017 at 10:59

2 Answers 2

13

Is there a [uBlock Origin] filter that only works on the root page?

Yes, use the document filter option:

||youtube.com^|$document
4
  • With this filter, YouTube videos embedded on other websites played normally as expected. However, it's worth noting that the video page itself will still be blocked.
    – Stevoisiak
    May 7, 2017 at 2:37
  • I've understood that he only wants to block a single page, youtube.com. The filter blocks youtube.com completely.
    – user198350
    Sep 4, 2017 at 11:04
  • 1
    You're both right, I misread. I corrected my answer (added trailing |).
    – rhill
    Sep 4, 2017 at 14:00
  • Doesn't really work. Yes, first visit will block it, however, when you go to a site that has an embedded youtube video, click on it to open it in Youtube and in Youtube click the home button brings you to the root page...
    – Malachi
    Jan 17, 2018 at 21:27
0

With Squid Cache Rule (see Why Squid):

acl whitedomains dstdomain -i "/path_to_acl/whitedomains.txt"
acl blackdomains dstdomain -i "/path_to_acl/blackdomains.txt"
http_access allow whitedomains
http_access deny blackdomains

Content of the lists:

/path_to_acl/whitedomains.txt
.account.youtube.com
.google.com

/path_to_acl/blackdomains.txt
.youtube.com
.googlevideo.com
.ytimg.com

PD: Since February 2014, Google uses the accounts subdomain .youtube.com to authenticate their services.

Source: Blackweb Project

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .