-
Notifications
You must be signed in to change notification settings - Fork 0
/
videodfp.html
371 lines (356 loc) · 16.7 KB
/
videodfp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
## -*- coding: utf-8 -*-
<!DOCTYPE html>
<html lang="${language}">
<%
import re;
t={'hora':3600, 'min':60,'sec':1};
%>
<head>
<title>${videoInfo["title"]} - ${'Auto Subtitles' if isASR else 'Transcript'} (${language})</title>
<meta name="viewport" content="width=980,maximum-scale=6.0" />
<!--link href="/res/css/bootstrap.min.css" rel="stylesheet" media="screen" /-->
<link href="/res/css/basic.css" rel="stylesheet" >
<link rel="canonical" href="/id/${videoId}?lang=${language}${'&kind=asr' if isASR else ''}" />
<link name="upstream" rel="code-author" href="https://github.com/arivero/transcriptsearch"/>
<link name="website" rel="code-license" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"/>
<link name="transcript_text_cc" rel=license href="http://creativecommons.org/licenses/by/3.0/"/>
<link name="transcript_text_yt" rel=license href="http://www.youtube.com/t/terms">
<meta name="creation_date" content="${videoInfo['publishedAt']}" />
<base href="http://www.transcriptsearch.com.es/id/${videoId}" />
<meta name="distribution" content="global">
<META HTTP-EQUIV="EXPIRES" CONTENT="12 Jul 2014 11:11">
<link rel="original-source" href="http://www.youtube.com/watch?v=${videoId}" />
<!--original source vease http://googlenewsblog.blogspot.com.es/2010/11/credit-where-credit-is-due.html
Habria que usar tambien description, channelId y channelTitle, como publishers
-->
<meta property="og:video" content="http://www.youtube.com/v/${videoId}" />
<meta property="og:type" content="video" />
%if len(transcript)>3 and transcript[0].text and transcript[1].text and transcript[-1].text:
<meta name="description" content="${(transcript[0].text +" "+transcript[1].text +' (...)" '+transcript[-1].text).replace("\n"," ").replace('"','')}"/>
%endif
<meta name="twitter:description" content="${videoInfo["description"][:160]}..." />
<script type="text/javascript">
window.google_analytics_uacct = "UA-80442-5";
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-80442-5', 'www.transcriptsearch.com.es');
ga('send', 'pageview');
</script>
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/97804370/dfpFoot', [[728, 90], [970, 90]], 'div-gpt-ad-1375728766120-0').addService(googletag.pubads());
googletag.defineSlot('/97804370/dfpHeader', [[250, 250], [300, 250], [320, 50], [336, 280]], 'div-gpt-ad-1375728766120-1').addService(googletag.pubads());
googletag.defineSlot('/97804370/dfpSide', [[120, 240], [125, 125], [120, 600], [160, 600], [180, 150]], 'div-gpt-ad-1375728766120-2').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>
<body style="font-size:small;max-width:980px;margin-left:auto ;margin-right:auto">
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AddThis Smart Layers BEGIN -->
<!-- Go to http://www.addthis.com/get/smart-layers to customize -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51d9946d1552ca72"></script>
<script type="text/javascript">
addthis.layers({
'theme' : 'transparent',
'share' : {
'position' : 'left',
'numPreferredServices' : 4
}
});
</script>
<!-- AddThis Smart Layers END -->
<div itemscope="" itemtype="http://schema.org/Article">
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=undefined"></script>
<!-- AddThis Button END -->
<div style="width:2em;height:2em;display:block;float:left"><small><a href="/"><i class="icon-search"></i>home</a></small></div>
<div style="display:block;float:left;margin-right:0.2em;margin-top:4.1em">
<!-- dfpHeader -->
<div id='div-gpt-ad-1375728766120-1'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1375728766120-1'); });
</script>
</div>
</div>
<div id="rightheadbox" style="display:block;margin-left:364px;">
<center>
<h1><span itemprop="name">${videoInfo["title"]}</span></h1>
</center>
<div style="display:block">
<!-- AddThis Button BEGIN -->
<div style="display:inline-block;float:right" class="addthis_toolbox addthis_default_style addthis_16x16_style">
<a class="addthis_button_twitter"></a>
<a class="addthis_button_facebook"></a>
<a class="addthis_button_reddit"></a>
<a class="addthis_button_tuenti"></a>
<!--a class="addthis_button_pdfonline"></a>
<a class="addthis_button_pdfmyurl"></a-->
<a class="addthis_button_yahoomail"></a>
<a class="addthis_button_gmail"></a>
<a class="addthis_button_hotmail"></a>
</div>
<script async type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=undefined"></script>
<!-- AddThis Button END -->
<g:plusone></g:plusone>
<div style="float:right;display:block">
<a rel="nofollow,alternate" title="In YT, look for transcript button, next to statistics button"
href="http://www.youtube.com/watch?v=${videoId}"><button class="btn">See in YouTube</button></a>
%if storyboard_spec=="noUrl" or videoInfoFull["status"]["license"]<>"creativeCommon":
<small>(**)</small>
%else:
<a rel="alternate" title="scriptboard ${videoId}" href="/sb/${videoId}?lang=${language}${'&kind=asr' if isASR else ''}"><button class="btn btn-primary">See comic-like layout</button></a>
%endif
</div>
<div id="leftsubheader" style="clear:right;" ></div>
<!-- aqui podriamos limitarnos a items del tipo track, por si acaso-->
<dl class="dl-horizontal" style="display:block">
%for item in trList:
<dt> ${item.attrib["name"] if "name" in item.attrib else ''}</dt> \
<dd><a name="${item.attrib["name"] if "name" in item.attrib else ''}" \
%if not ("kind" in item.attrib):
rel="alternate" hreflang="${item.attrib["lang_code"]}" \
%endif
href="?lang=${item.attrib["lang_code"]}${"&kind="+item.attrib["kind"] if "kind" in item.attrib else ''}">\
${item.attrib["lang_translated"]}\
%if "kind" in item.attrib:
(${item.attrib["kind"]}!!)\
%endif
%if "lang_default" in item.attrib:
(default)\
%endif
</a></dd>
%endfor
</dl>
</div>
</div>
<h3 style="margin-left:4em;clear:both">Transcript <sup>(*)</sup></h3>
<div id="sbparent" style="display:block;float:right;position:relative;">
%if 2>1 or storyboard_spec=="noUrl" or len(transcript)>120:
<!-- dfpSide -->
<div id='div-gpt-ad-1375728766120-2'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1375728766120-2'); });
</script>
</div>
%else:
<!-- dfpSide or dfpSideShort -->
%endif
<div id="sb"> </div>
</div>
<div id="transcript" totallines=${len(transcript)} itemprop="articleBody" style="text-align:center; width:90%; display:block; margin-left:auto; margin-right: auto; ">
<p style="text-align:left; display:block; margin-left:auto; margin-right: auto; font-family:monospace ">
%for i, textline in enumerate(transcript):
<span \
%for key in textline.attrib:
${key}=${textline.attrib[key]} \
%endfor
%if textline.text<>None:
> ${textline.text} </span>\
%else:
> </span>\
%endif
%if textline.text<>None and len(textline.text)>0 and textline.text[-1]=="." :
</p>
<p style="text-align:left; display:block; margin-left:auto; margin-right: auto; font-family:monospace ">\
%else:
<br/>
%endif
%endfor
</p>
</div>
<div></div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<script>
window.onload=function(){
//code from http://userscripts.org/scripts/review/164573
storyboard_spec='${storyboard_spec}';
if (storyboard_spec=="noUrl") {return} ;
var lines = storyboard_spec.split('|');
var q;
quality = Math.min(3,lines.length - 2); // default to best quality
//var quality = -1;
// do {
// quality++;
// q = lines[quality + 1].split('#');
// } while(parseInt(q[0], 10) < 400 && quality + 2 < lines.length);
//quality = 0
var q = lines[quality + 1].split('#');
var s = {
url: lines[0].replace('$L', quality).replace('$N', q[6]),
width: parseInt(q[0], 10),
height: parseInt(q[1], 10),
count: parseInt(q[2], 10),
cols: parseInt(q[3], 10),
rows: parseInt(q[4], 10),
sigh: q[7]
};
s.sheetSize = s.cols * s.rows;
s.sheetCount = ((s.count / s.sheetSize) | 0) + 1; // bitwise OR to loose decimals
s.countOnLastSheet = ((s.count - 1) % s.sheetSize) + 1;
document.getElementById('sb').setAttribute("style","overflow:hidden;display:block;float:right"); //el orden importa, primero asi...
document.getElementById('sb').style.width=s.width+'px'; //y luego de la forma vieja
//document.getElementById('sb').style.height="100%"
document.getElementById('sb').style.overflow="hidden";
document.getElementById('sb').style.position="relative";
var sheet=0; do {
var targetsrc=s.url.replace('$M', sheet) + "?sigh=" + s.sigh;
var imagen=document.createElement("img"); // Mucho de lo que definimos aqui deberia ir a una CSS class.
imagen.setAttribute("src",targetsrc);
imagen.style["max-width"]="none";
imagen.style.margin="0px 0px "+(-1)*(s.rows-1)*s.height+"px 0px"; //top right bottom left
//imagen.style.margin=(-1)*s.height+"px 0px "+(-1)*(s.rows-2)*s.height+"px "+(-1)*s.width*(s.cols-1)+"px";
imagen.style.position="absolute";
//clip solo funciona para fixed o absolute!!!!!. Ademas, en IE viejo no admite separar por comas
//ver https://developer.mozilla.org/en-US/docs/Web/CSS/clip?redirectlocale=en-US&redirectslug=CSS%2Fclip
//imagen.setAttribute("style","position:fixed; clip: rect(top right bottom left 10px, 160px, 70px, 20px);");
imagen.style.clip="rect(0px, "+s.width+"px, "+s.height+"px, 0px)";
imagen.style.top=sheet*s.height+"px"
document.getElementById("sb").appendChild(imagen);
imagen.onmouseover=function(){this.style.zIndex=99;
this.style["border-style"]="solid";
//this.style["pointer-events"]="none";
if (this.previousElementSibling != null) {
this.previousElementSibling.style.zIndex=0;
//this.style["border-style"]="none";
}};
imagen.onmouseout=function(){this.style.zIndex=0;
this.style["border-style"]="none";};
%if videoInfoFull["status"]["license"]<>"ANYcreativeCommon":
imagen.onclick=function(){
window.location="/sb/${videoId}?lang=${language}${'&kind=asr' if isASR else ''}"
};
%endif
// setAttribute("height", "768"); setAttribute("width", "1024");
sheet ++;
} while(sheet < s.sheetCount );
document.getElementById("transcript").style["min-height"]=2*s.height+"px"
//ahora, ajustamos el espaciado
window.onresize=function(){
var altura=document.getElementById("transcript").clientHeight; // offsetH, o clientHeight sin los scroll ni border, o scrollHeight
var alturasb=document.getElementById("sb").clientHeight;
var alturasbparent=document.getElementById("sbparent").clientHeight;
var k=alturasbparent/altura;
if (k<0.95 || k > 1.05) {
altura=altura-(alturasbparent-alturasb);
var children=document.getElementById('sb').children;
//alturaelem=s.height;
totalelems=children.length;
for (var i = 0; i < children.length; i++)
{
children[i].style.top=i*(altura)/(totalelems)+"px";
}
document.getElementById("sb").style.height=altura+"px";
setTimeout(window.onresize,1); //scope milagroso: usa el s del metodo donde lo hemos definido, pero el onresize nuevo
} ;
};
setTimeout(window.onresize,0);
}
</script>
<small>(*): If a transcript is not set in the URL query, we show the last
of the list of available transcripts. Note that "ASR" transcripts come from
the voice recognition software at Youtube.
<p>(**): Alternate views, such as the scriptboards generated by the <tt>/sb/</tt> url,
are derived work and then they are only linked and indexed for <i>creativeCommon</i> license. Note
that they also depend of the availability of snapshots and text.
</small>
<div id="info" style="column-count:2;-moz-column-count:2;-webkit-column-count:2;column-gap:1%;-webkit-column-gap:1%;-moz-column-gap:1%">
<script>
function putFBname(respuesta){
span=document.getElementById(respuesta["id"]);
span.innerHTMLprev=" "+respuesta["property"]["/type/object/name"]["values"][0]["text"];
document.write(span.innerHTMLprev);
}
</script>
<p><b>VideoID</b>: YT/<a rel="alternate" href="http://www.youtube.com/watch?v=${videoId}">${videoId}</a></p>
<p><b>License</b>: <i>${videoInfoFull["status"]["license"]}</i> from
<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
channel <a itemprop="name" href="http://www.youtube.com/channel/${videoInfo['channelId']}">YT:user:${videoInfo['channelTitle']}</a>
</span>
</p>
<p><b>Youtube CategoryID</b>: <a rel="tag" href="/${videoInfo['categoryId']}">${videoInfo["categoryId"]}</a> </p>
<p><b>Duration:</b> ISO 8601 ${videoInfoFull["contentDetails"]["duration"]} = \
${sum(t[x] * float(y or 0) for x,y in re.compile("PT((?P<hora>[0-9.]+?)H)?((?P<min>[0-9.]+?)M)?((?P<sec>[0-9.]+?)S)?").match(videoInfoFull["contentDetails"]["duration"]).groupdict().items())} seconds</p>
%if videoInfoFull.has_key("topicDetails"):
<p><b>FreeBase Topics: </b>
%for item in videoInfoFull["topicDetails"]["topicIds"]:
<a rel="tag" itemprop="keywords" href="${item}">${item}</a><span itemprop="keywords" id=${item}></span>
<script src="https://www.googleapis.com/freebase/v1/topic${item}?filter=/type/object/name&callback=putFBname"></script>;
%endfor
</p>
%endif
%if videoInfoFull.has_key("recordingDetails"):
%if videoInfoFull["recordingDetails"].has_key("locationDescription"):
<p><b>Recording Location:</b> ${videoInfoFull["recordingDetails"]["locationDescription"]}</p>
%endif
%if videoInfoFull["recordingDetails"].has_key("recordingDate"):
<p><b>Recording Date:</b> <span itemprop="dateCreated">${videoInfoFull["recordingDetails"]["recordingDate"]}</span></p>
%endif
%endif
</div>
<script>
document.getElementById("leftsubheader").appendChild( document.getElementById("info"));
</script>
<center>
<!-- dfpFoot -->
<div id='div-gpt-ad-1375728766120-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1375728766120-0'); });
</script>
</div>
</center>
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:3;column-gap:1%;-webkit-column-gap:1%;-moz-column-gap:1%">
</div>
<hr>
<center><a href="/res/about.html">About this site</a>
<small> | The code for this webservice is available under Affero AGPLv3 license in
repository <a href="https://github.com/arivero/transcriptsearch">github:arivero/transcriptsearch</a>.
</small>|
<a href="http://www.viglink.com/legal/disclosures/users?vgtag=badge">
<img alt="VigLink badge" height="31" src="//www.viglink.com/images/badges/88x31.png" title="Links monetized by VigLink" width="88" />
</a>
</center>
<!--script async src="/res/js/bootstrap.min.js"></script-->
<span itemprop="provider" itemscope itemtype="http://schema.org/Person">
<link itemprop="url" href="http://www.youtube.com/user/${videoInfo['channelTitle']}">
</span>
<meta itemprop="datePublished" content="${videoInfo['publishedAt']}"/>
</div> <!--end itemscope-->
<script type="text/javascript">
var vglnk = { api_url: '//api.viglink.com/api',
key: '0ff6dcd4eb8644f68ac5dfe2ba07f7ac' };
(function(d, t) {
var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;
s.src = ('https:' == document.location.protocol ? vglnk.api_url :
'//cdn.viglink.com/api') + '/vglnk.js';
var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);
}(document, 'script'));
</script>
</body>
</html>