[Privoxy-users] youtube, vimeo & others

Fabian Keil fk at fabiankeil.de
Mon Jun 1 09:50:32 UTC 2020


Kirk Wolff <kirk at wolffelectronicdesign.com> wrote:

> I'm trying to control what videos my children are allowed to see on
> their devices and I've played with squidguard and dansguardian. The
> YouTube content filter is totally unsuitable for what i want to do. I
> want to approve each video they are allowed to see so they aren't able
> to distract themselves from their schoolwork.
> 
> Unfortunately the online program they use draws from many different
> video hosting sites. It's not as simple as filtering on the video url
> because the embedded player calls on innumerable uris. Also, Microsoft
> family seems to mostly work, but it doesn't block search within a page
> on YouTube or Vimeo which means they can watch anything they want from
> any allowed video page.
> 
> Since what I'm basically trying to do is filter, i would think privoxy
> would be powerful enough to accomplish this. One thing I've noticed is
> there's something about "YouTube API v3 key" that a few commercial
> offerings are using for filtering YouTube, but this doesent address
> other platforms. Does anyone understand how to do this?

I don't think Privoxy is powerful enough to properly restrict
access to white-listed videos on youtube. As you mentioned,
watching a single video requires numerous requests to numerous
hosts and white-listing a single URL is insufficient.

From watching a single video I get:

fk at t520 /tmp/youtube-log $privoxy-log-parser.pl --statistics --url-statistics-threshold 1 --host-statistics-threshold 1 youtube.log 
Client requests total: 158
Crunches: 15 (9.49%)
Blocks: 15 (9.49%)
Fast redirections: 0 (0.00%)
Connection timeouts: 0 (0.00%)
Connection failures: 0 (0.00%)
Outgoing requests: 143 (90.51%)
Server keep-alive offers: 0 (0.00%)
New outgoing connections: 143 (90.51%)
Reused connections: 0 (0.00%; server offers accepted: 0.00%)
Empty responses: 0 (0.00%)
Empty responses on new connections: 0 (0.00%)
Empty responses on reused connections: 0 (0.00%)
Client connections: 170
Bytes transfered excluding headers: 18524028
Client requests per connection distribution:
     160: 1
       6: 3
       4: 2
Enable --show-complete-request-distribution to get less common numbers as well.
Improperly accounted requests: ~28
Method distribution:
     129 : GET     
      29 : POST    
Client HTTP versions:
     158 : HTTP/1.1
HTTP status codes:
     143 : 200     
      15 : 403     
Requested URLs:
12 : https://www.youtube.com/youtubei/v1/log_event?alt=json&key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8
6 : https://googleads.g.doubleclick.net/pagead/id
2 : https://i.ytimg.com/vi/JmcA9LIIXWw/maxresdefault.jpg
1 : https://r5---sn-25ge7nsl.googlevideo.com/videoplayback?expire=1590774002&ei=kvTQXsn-N6PxxgK6173ADg&ip=51.15.80.14&id=o-AGbgfPJPzS-NyGkgof9-afdOTO0I3ccrOVT1p_Pg9qcE&itag=133&aitags=133%2C134%2C135%2C160%2C242%2C243%2C244%2C278%2C394%2C395%2C396%2C397&source=youtube&requiressl=yes&mh=Ja&mm=31%2C29&mn=sn-25ge7nsl%2Csn-25glen7l&ms=au%2Crdu&mv=m&mvi=4&pl=18&gcr=nl&initcwndbps=481250&vprv=1&mime=video%2Fmp4&gir=yes&clen=4402079&dur=235.520&lmt=1584652419131490&mt=1590752320&fvip=5&keepalive=yes&c=WEB&txp=5532432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhALfhK5ysv3TAKK8L622EEcSSmaBuVvu0szOYe-Fv0gusAiEA_HUcGQ8SVdpf2uVSYigzyryauDG_7wZuAsxBMefzbyE%3D&alr=yes&sig=AOq0QJ8wRQIhAL5r5tJMNVEZT2h79hdq_wlEdgofG4TZsIJo-ot1YVBQAiBlDL_v6xaeotXtD1buSAixLV_UzMQfE4lCI9bJJ9504Q%3D%3D&cpn=6Oelrwj3tdyQ5_LU&cver=2.20200528.05.00&range=0-1331&rn=18&rbuf=0
1 : https://r5---sn-25ge7nsl.googlevideo.com/videoplayback?expire=1590774002&ei=kvTQXsn-N6PxxgK6173ADg&ip=51.15.80.14&id=o-AGbgfPJPzS-NyGkgof9-afdOTO0I3ccrOVT1p_Pg9qcE&itag=140&source=youtube&requiressl=yes&mh=Ja&mm=31%2C29&mn=sn-25ge7nsl%2Csn-25glen7l&ms=au%2Crdu&mv=m&mvi=4&pl=18&gcr=nl&initcwndbps=481250&vprv=1&mime=audio%2Fmp4&gir=yes&clen=3813359&dur=235.566&lmt=1584637982848578&mt=1590752320&fvip=5&keepalive=yes&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgLIahbysnv_TOEKdlrlDHqpej4nI0j2nOO4LKdYHKLjMCIDA_yagqCu5uEokaXBXFWOD0c3kAPjnWa6ZlNPLazwex&alr=yes&sig=AOq0QJ8wRgIhAOPYioVjeaHw2HmBNUpSRPaqKFDCztdH9yPhgtKa2nW0AiEAz4f3jSu_9-YQFKiv8Sjqgqm-SrdOScZz3cmM0pAnOVQ%3D&cpn=6Oelrwj3tdyQ5_LU&cver=2.20200528.05.00&range=2748248-3232903&rn=31&rbuf=91648
1 : https://i.ytimg.com/vi/F6dmMzPVhyY/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLD9oTmAvYX2DapCXc3g4SoWDzq2zg
[...]
1 : https://r5---sn-25ge7nsl.googlevideo.com/videoplayback?expire=1590774002&ei=kvTQXsn-N6PxxgK6173ADg&ip=51.15.80.14&id=o-AGbgfPJPzS-NyGkgof9-afdOTO0I3ccrOVT1p_Pg9qcE&itag=160&aitags=133%2C134%2C135%2C160%2C242%2C243%2C244%2C278%2C394%2C395%2C396%2C397&source=youtube&requiressl=yes&mh=Ja&mm=31%2C29&mn=sn-25ge7nsl%2Csn-25glen7l&ms=au%2Crdu&mv=m&mvi=4&pl=18&gcr=nl&initcwndbps=481250&vprv=1&mime=video%2Fmp4&gir=yes&clen=2252162&dur=235.520&lmt=1584639479761296&mt=1590752320&fvip=5&keepalive=yes&c=WEB&txp=5532432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAORm9M0h3jy-0EJY08JBmtUD_wshz0js8V0Gz3rhdPDOAiEA-m2X-2vLBZlCND7O0fntNppuD_5WW5EHPHekq5ZnisU%3D&alr=yes&sig=AOq0QJ8wRgIhAK-u2Udtc3HE6sPA9BnHVMlWVsABX7TWQq8xi7HVQ9JsAiEA8e6GuAvgtwtsKe0vmQw5AXYu8Ca1hnDE2zQH0q36kFY%3D&cpn=6Oelrwj3tdyQ5_LU&cver=2.20200528.05.00&range=223284-384100&rn=17&rbuf=18227
1 : https://i.ytimg.com/favicon.ico
1 : https://www.youtube.com/api/stats/ads?ver=2&ns=1&event=4&device=1&content_v=JmcA9LIIXWw&el=detailpage&ei=kvTQXoaoOfTXxN8P4om7oAU&devicever=2.20200528.05.00&bti=23788601&format=2_1_0&break_type=1&conn=0&cpn=6Oelrwj3tdyQ5_LU&lact=9&m_pos=0&mt=41775&p_h=480&p_w=640&rwt=[RWT]&sdkv=h.3.0.0&slot_pos=0&vis=0&vol=100&wt=1590752434667&ad_cpn=[AD_CPN]&ad_id=390916499658&ad_len=-1&ad_mt=0&ad_sys=AdSense&ad_v=0&i_x=[I_X]&i_y=[I_Y]&aqi=
Requested Hosts:
67 : www.youtube.com
27 : r5---sn-25ge7nsl.googlevideo.com
24 : i.ytimg.com
9 : googleads.g.doubleclick.net
7 : r5---sn-pouxga5o-vu2s.googlevideo.com
5 : fonts.gstatic.com
3 : r5---sn-4g5e6nsz.googlevideo.com
3 : www.google.com
3 : fonts.googleapis.com
2 : securepubads.g.doubleclick.net
2 : yt3.ggpht.com
1 : i9.ytimg.com
1 : accounts.google.com
1 : static.doubleclick.net
1 : tpc.googlesyndication.com
1 : www.google.sc
1 : www.google.nl

Even if the list of requests were stable (which it isn't), analysing
them and/or the responses with Privoxy filters which only support
pcrs seems like a futile endeavour.

Using external filters as documented at:
https://www.privoxy.org/user-manual/filter-file.html#EXTERNAL-FILTER-SYNTAX
is unlikely to work either because from looking at a single request or
response the state of Youtube's player isn't obvious.

You probably need an application that can mimic Youtube's
JavaScript-based player and request the white-listed videos
itself. A wrapper around something like youtube-dl could work
but making it accessible to children is probably a fair amount
of work.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-users/attachments/20200601/9496407a/attachment.bin>


More information about the Privoxy-users mailing list