How to Allow Only Specific Video on YouTube

Imagine you have installed our Web Safety Squid integrated web filter and completely blocked access to YouTube by blocking “Social Networking” and “Video Sharing” categories of sites.

Now you would like to allow access to a single video on YouTube. You have HTTPS filtering enabled (important!). To do this you need to allow access to streaming media from Google sites (where videos are hosted) and allow access to one specific YouTube video by ID.

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

.googlevideo.com

Step 2. Add the following regular expression to Web UI / 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\?.*

Step 3. Add the following regular expression to Web UI / 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\/.*

Step 4. Finally add the following regular expression to Web UI / 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).

Note: YouTube may regularly change its URL video coding scheme so if this regular expression does not work, ask support@diladele.com to research this issue again.

About sichent

sichent
This entry was posted in Linux. Bookmark the permalink.

2 Responses to How to Allow Only Specific Video on YouTube

  1. Bert386 says:

    Is it possible to do the same for non embedded videos? ie can we change the regex to https?:\/\/\w+\.youtube\.com\/watch?\/z8aBZZnv6y8 or similar?

    • sichent says:

      The filter works with stateless HTTP requests – it does not understand if the video is “embedded” or not.
      Just use another regex that you consider appropriate (not the embedded one).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s