Allow partial websites/specific YouTube videos

Updated 1 year 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

Lets 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 we need to compile a Keyword List in order to create a suitable Filter Rule
We use Keyword lists for this instead of Custom URL as they offer more flexibility for filtering URL paths and partial URLs. An in-depth guide on keyword lists can be found here

The list will need to contain the alpha-numeric video paths you want to allow:

If there is a rule active 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 appropriate Filter Rules to enforce the required logic
Rule order is very important. For more information about this please consult this Guide on troubleshooting filter rules. Or this Guide on Rule Management

Create the following two rules. The first (executes first) one allows the URLs we set in the Keyword Lists whilst the bottom one (executes second) will block everything else.

Each rule is shown below:

The first rule (allow) specifies the YouTube URLs keyword list. 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)

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?