YouTube: How to Allow Only Specific Video

Important

This article is now obsolete. Due to recent changes in how the YT web player gets the video content allowing only one YT video is not possible any more. It is well possible to restrict explicit videos on YouTube as explained in the article Restricting and Filtering YouTube Videos.

I have YouTube blocked by blocking “Social Networking” and “Video Sharing” categories of sites. Nevertheless I need to allow access to a single video on YouTube. HTTPS filtering setting is enabled (important!). Is it possible?

You need to allow access to streaming media from Google sites (where youtube videos are hosted) and allow access to one specific YouTube video by ID.

Steps:

  1. Add the following domain to Web Filter / Policy / Exclusions / Domain name. This will allow direct access to all youtube media files. Note leading dot:

    .googlevideo.com
    
  2. Add the following regular expression to Web Filter / Policy / Exclusions / URL Regex. This will allow access to information about video attributes (for example length of video, title, caption, etc) for all youtube media files:

    https?:\/\/\w+\.youtube\.com\/get_video_info\?.*
    
  3. Add the following regular expression to Web Filter / Policy / Exclusions / URL Regex. This will allow access to styles and javascripts needed to play any YouTube media file:

    https?:\/\/\w+\.youtube\.com\/yts\/\w+bin\/.*
    
  4. Finally add the following regular expression to Web Filter / Policy / Exclusions / URL Regex. This will allow access to ONLY ONE video identified by z8aBZZnv6y8 video id and accessed by “embed” style link (https://www.youtube.com/embed/z8aBZZnv6y8). You will then need to share the video link to your users, for example by embedding it into your site:

    https?:\/\/\w+\.youtube\.com\/embed\/z8aBZZnv6y8\?.*
    

When you need to add another video, lookup its video id from the browser url, and repeat point 4 only. Access to all other videos on youtube from browser will be blocked (because you have video sharing category blocked by default).