Allow partial websites/specific YouTube videos - Console

Updated 3 hours ago by admin

Allow specific YouTube videos.

In some instances, you might want to block access to YouTube as a whole but allow partial access to specific videos. This article will guide you through the process.

Example Scenario

Let's take an example of wanting to block youtube.com but allow specific videos such as this video https://www.youtube.com/watch?v=Ncf23ZiUK6I

  1. Firstly, we check the website using the browser Development Tools to make sure we have all the necessary URLs
On most browsers, pressing F12 will open Developer Tools, then navigate to the Network tab

In general, YouTube uses these three URLs:

youtube.com (main URL)
ytimg.com (Content Server)
googlevideo.com (Video Player)
  1. Secondly, create a Keyword Category (Browse ⟶ Categories ⟶ Keywords) to use in a rule
We use Keyword Categories for this instead of Custom URL Categories, as they give more flexibility for matching URL paths and partial URLs. See Keyword Lists (Keyword Categories) for an in-depth guide.

Set Content Match to URL, then add a pattern (Match Type Contains) for each alpha-numeric video ID you want to allow:

If there is an active rule that blocks the Web Category Streaming & Downloadable Video, you should also add. googlevideo.com
googlevideo.com
/s/desktop
/s/player
/s/_/ytmainappweb
  1. Next, create rules in Browse ⟶ Rule Builder to enforce the required logic
Rule order is very important. For more information, see Troubleshooting Web Security Filter Rules or WS - Rule Builder (Filter Rules).

Create the following two rules. The first (executes first) one allows the URLs we set in the Keyword Lists, whilst the one below it (executes second) blocks everything else.

Each rule is shown below:

The first rule (final action Allow) has a Keyword Category match set to your YouTube keyword category. Any additional conditions are up to you.

The second rule (block) blocks the general associated Web Category Streaming & Downloadable Video or the main YouTube URL (depending on your preference), using a Web Category or Custom URL match with a Block action.

The result should be that access to the website is blocked unless the specific keyword string is contained in the URL.


How did we do?