[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #6005 [Tor Browser]: Secure download of videos from YouTube
#6005: Secure download of videos from YouTube
--------------------------+--------------------------
Reporter: cypherpunks | Owner: tbb-team
Type: enhancement | Status: new
Priority: High | Milestone:
Component: Tor Browser | Version:
Severity: Normal | Resolution:
Keywords: needs-triage | Actual Points:
Parent ID: | Points:
Sponsor: |
--------------------------+--------------------------
Changes (by cypherpunks):
* severity: => Normal
Comment:
Here is a surrogate
{{{
#!js
user_pref("noscript.surrogate.YouTube.replacement", "'use strict';let
k=document.getElementById('player-
api'),l=document.createElement('VIDEO'),m=k.getBoundingClientRect();l.controls=!0;l.a=!0;l.poster=document.querySelector(\"meta[property='og:image']\").content;['width','height','style'].forEach(function(a){l[a]=m[a];});k.appendChild(l,k);function
n(...a){let r=[];a.forEach(function(a){a=(new
RegExp('\"'+a+'\":(\"[^\"]+\")','i')).exec(document.documentElement.innerHTML);a&&JSON.parse(a[1]).split(',').forEach(function(a){let
b={};a.split('&').forEach(function(a){(a=/^(.+?)=(.*)$/.exec(a))&&(b[decodeURIComponent(a[1])]=decodeURIComponent(a[2]));});r.push(b);});});return
r;} let
p={5:22,17:30,18:19,22:9,36:23,43:20,133:25,134:18,135:15,136:13,137:7,160:29,242:26,243:24,244:16,247:14,248:8,264:2,266:1,271:3,278:28,298:12,299:6,302:11,303:5,313:0,'tfvws:h264_hd1080':4,'tfvws:h264_hd':10,'tfvws:h264_hq':17,'tfvws:h264':21,'tfvws:h264_ld':27};let
q=n('url_encoded_fmt_stream_map','adaptive_fmts').filter((a)=>!!a.url).sort((a,b)=>p[a.itag]-p[b.itag]);let
t=n('caption_tracks');q.forEach(function(a){let
b=document.createElement('A');b.href=a.url;let
c=document.createElement('SOURCE');c.src=b.href;c.type=a.type;l.appendChild(c);a.fallback_host&&(b.host=a.fallback_host,c=document.createElement('SOURCE'),c.src=b.href,c.type=a.type,l.appendChild(c));});/*t.forEach(function(a){let
b = document.createElement('TRACK');b.label = a.n;b.b = a.lc;b.src =
a.u;l.appendChild(b);});*/ const aa=\"I3HsDoX\";let
v=document.createElement('STYLE');document.head.appendChild(v);v.sheet.insertRule(\".\"+aa+\"
{display: inline; padding:
1%;}\",0);v=document.createElement('UL');k.appendChild(v);for(let w of
t){if('en'==w.lc){let
x=document.createElement('A');x.href=w.u;x.innerHTML=w.n;x.download=document.querySelector(\"meta[name='title']\").content+\"|\"+w.n+'.'+w.lc+'.xml';let
z=document.createElement('LI');z.className=aa;z.appendChild(x);v.appendChild(z);}}
let y=document.createElement('A');y.href=q[0].url;y.innerHTML=\"DL video
\"+(q[0].quality||q[0].quality_label||\"\");y.title=q[0].type;y.download=!0;let
z=document.createElement('LI');z.className=aa;z.appendChild(y);v.appendChild(z);");
user_pref("noscript.surrogate.YouTube.sources",
"!www.youtube.com/watch?*");
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6005#comment:6>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs