ProxySG Content Policy Language (CPL) code for allowing one or more videos on YouTube
search cancel

ProxySG Content Policy Language (CPL) code for allowing one or more videos on YouTube

book

Article ID: 168157

calendar_today

Updated On:

Products

Advanced Secure Gateway Software - ASG ProxySG Software - SGOS

Issue/Introduction

How can users be limited to specific videos on YouTube?




 

Resolution

To restrict videos, add a CPL Layer in Visual Policy Manager (VPM) as the last layer in order. Copy and paste the following Content Policy Language (CPL) code:
 

;***** Start YouTube Channel Allow ******
;Add this line for SSL interception only if SSL interception isn't already enabled. See TECH244731 "Configure SSL intercept for an explicit deployment using a self-signed certificate" 
<ssl-intercept>
url.domain=youtube.com ssl.forward_proxy(https) ssl.forward_proxy.issuer_keyring(default)
;If there is any kind of SSL error please see TECH241928 "Add ProxySG certificate into a browser" to learn how to import and trust the ProxySG default certificate  

<Proxy>
;allows the list of URL's
ALLOW condition=__CondList1Regex_allow
;Denies direct access to youtube.com and several other YouTube-related resources
DENY condition=YT_URLS url.regex="v="  

;Definitions
define condition __CondList1Regex_allow
;This line will be the name of the channel, in this example: https://www.youtube.com/user/YouTubeHelp
url.regex="YouTubeHelp"
;Allow access to video lists. There will be several lists present in one channel, and all videos will need to reviewed to confirm the list. This is defined after the '&list=' in the URL
;Example List 1 - https://www.youtube.com/watch?v=qY173FCff_c&list=PL9hW1uS6HUfuBPkrzcJNE0z1qzF7paCBn
url.regex="PL9hW1uS6HUfuBPkrzcJNE0z1qzF7paCBn"
;Example List 2 - https://www.youtube.com/watch?v=aue8E8r3Mz8&list=PL9hW1uS6HUfsiA_oBoskOWmtlwN8tWHeX
url.regex="PL9hW1uS6HUfsiA_oBoskOWmtlwN8tWHeX"
;Example List 3 - https://www.youtube.com/watch?v=8b0aEoxqqC0&list=PL9hW1uS6HUftLdHI6RIsaf-iXTm09qnEr
url.regex="PL9hW1uS6HUftLdHI6RIsaf-iXTm09qnEr"
;Now we need to allow every video on every list for the channel(s) that you would like to allow, this is the value 'v='
;Example Video 1 - https://www.youtube.com/watch?v=qY173FCff_c&list=PL9hW1uS6HUfuBPkrzcJNE0z1qzF7paCBn
url.regex="qY173FCff_c"
;Example Video 2 - https://www.youtube.com/watch?v=aue8E8r3Mz8&list=PL9hW1uS6HUfsiA_oBoskOWmtlwN8tWHeX
url.regex="aue8E8r3Mz8"
;Example Video 3 - https://www.youtube.com/watch?v=8b0aEoxqqC0&list=PL9hW1uS6HUftLdHI6RIsaf-iXTm09qnEr
url.regex="8b0aEoxqqC0"
end

define condition YT_URLS
url.domain=youtube.com
url.domain=ytimg.com
url.domain=googlevideo.com
url.substring=crossdomain.xml
end