http://www.labnol.org/internet/print-youtube-video/28217/
javascript:(function(){a=ytplayer.config.args.storyboard_spec;if(!a){alert("Sorry we cannot process this YouTube video. Could you please try another one");exit();}b=a.split("|");base=b[0].split("$")[0] "2/M";c=b[3].split("#");sigh=c[c.length-1];var imgs="";t=ytplayer.config.args.length_seconds;n=Math.ceil(c[2]/(c[3]*c[4]));for(i=0;i<n;i ){imgs ="<PICTURE='" base i ".jpg?sigh=" sigh "'><br/>";}var title=ytplayer.config.args.title;msg="<body style='background-color:#444;color:#eee;margin:20px auto;width:90%;text-align:center'><h2>TITLE</h2><div>IMAGES</div><br/><em><a href='http://labnol.org/?p=28217' style='text-decoration:none;color:#fff;font-style:bold'>Printed using the YouTube bookmarklet.</a></em></body>";msg=msg.replace("TITLE",title).replace("IMAGES",imgs).replace(/PICTURE/g,"img src");var labnol=window.open();labnol.document.open();labnol.document.write(msg);labnol.document.close();})();
1 - 我不知道如何使用此脚本获得更大的缩略图,也许youtube有限的图像质量/分辨率框架,因此此代码无法获得更大的版本?
2 - 一些新视频90-120分钟+需要几天才能显示完整的视频缩略图,这是真的吗?
感谢
答案 0 :(得分:2)
以下是bookmarklet的美化版本:
(function() {
a = ytplayer.config.args.storyboard_spec;
if (!a) {
alert("Sorry we cannot process this YouTube video. Could you please try another one");
exit();
}
b = a.split("|");
base = b[0].split("$")[0] + "2/M";
c = b[3].split("#");
sigh = c[c.length - 1];
var imgs = "";
t = ytplayer.config.args.length_seconds;
n = Math.ceil(c[2] / (c[3] * c[4]));
for (i = 0; i < n; i++) {
imgs += "<PICTURE='" + base + i + ".jpg?sigh=" + sigh + "'><br/>";
}
var title = ytplayer.config.args.title;
msg = "<body style='background-color:#444;color:#eee;margin:20px auto;width:90%;text-align:center'><h2>TITLE</h2><div>IMAGES</div><br/><em><a href='http://labnol.org/?p=28217' style='text-decoration:none;color:#fff;font-style:bold'>Printed using the YouTube bookmarklet.</a></em></body>";
msg = msg.replace("TITLE", title).replace("IMAGES", imgs).replace(/PICTURE/g, "img src");
var labnol = window.open();
labnol.document.open();
labnol.document.write(msg);
labnol.document.close();
})();
这个页面(部分是中文)似乎已经解开了我们可以用来计算labnol数学的计算方案: http://rplus.github.io/blog/2014/04/26/youtube-storyboard/
$L
确定故事板的大小以及每个“精灵”表格中有多少帧。
据此,这些是通过以下方式计算的:
L = 1
100(10 * 10),总共135(一个超过35)
L = 2
25(5 * 5),总共135(五个超过10)
L = 3
9(3 * 3),共135(仅15)
对于假设视频:
b
变量包含两个小尺寸的纸张(10x10)和两个较大尺寸的纸张
console.log(b)
["https://i.ytimg.com/sb/xxx/storyboard3_L$L/$N.jpg",
"48#27#100#10#10#0#default#XX-LJCqt8cvoKdNR-LktzyCucWU",
"80#45#242#10#10#10000#M$M#XXtyvKla08ayOvovocCEGBGtgfM",
"160#90#242#5#5#10000#M$M#XXNLRJzk9xaC36siHPgNM_ZsIlQ",
"320#180#242#3#3#10000#M$M#XXYfUj9jA3iVRkZk4QpfYICc53A"]
在计算c
时,小书签作者会抛弃其他三种尺寸,只留下160px(5x5)尺寸。
c = b[3].split("#");
console.log(c[2], c[3], c[4], c[2]/(c[3]*c[4]));
242 5 5 9.68
Ceil 9.68 = 10.
如果我们将b[3]
替换为b[4]
,并修正附加到'2/M'
网址的'3/M'
,我们会获得更高分辨率的图片。
使用较大版本进行简单替换(某些视频没有最大版本且会失败):
javascript:(function()%7Ba%3Dytplayer.config.args.storyboard_spec%3Bif(!a)%7Balert("Sorry we cannot process this YouTube video. Could you please try another one")%3Bexit()%3B%7Db%3Da.split("%7C")%3Bbase%3Db%5B0%5D.split("%24")%5B0%5D%2B"3/M"%3Bc%3Db%5B4%5D.split("%23")%3Bsigh%3Dc%5Bc.length-1%5D%3Bvar imgs%3D""%3Bt%3Dytplayer.config.args.length_seconds%3Bn%3DMath.ceil(c%5B2%5D/(c%5B3%5D*c%5B4%5D))%3Bfor(i%3D0%3Bi<n%3Bi%2B%2B)%7Bimgs%2B%3D"<PICTURE%3D%27"%2Bbase%2Bi%2B".jpg%3Fsigh%3D"%2Bsigh%2B"%27><br/>"%3B%7Dvar title%3Dytplayer.config.args.title%3Bmsg%3D"<body style%3D%27background-color:%23444%3Bcolor:%23eee%3Bmargin:20px auto%3Bwidth:90%25%3Btext-align:center%27><h2>TITLE</h2><div>IMAGES</div><br/><em><a href%3D%27http://labnol.org/%3Fp%3D28217%27 style%3D%27text-decoration:none%3Bcolor:%23fff%3Bfont-style:bold%27>Printed using the YouTube bookmarklet.</a></em></body>"%3Bmsg%3Dmsg.replace("TITLE",title).replace("IMAGES",imgs).replace(/PICTURE/g,"img src")%3Bvar labnol%3Dwindow.open()%3Blabnol.document.open()%3Blabnol.document.write(msg)%3Blabnol.document.close()%3B%7D)()%3B
使用最大的可用缩略图制作表格:
javascript:void%20function(){a=ytplayer.config.args.storyboard_spec,a||(alert(%22Sorry%20we%20cannot%20process%20this%20YouTube%20video.%20Could%20you%20please%20try%20another%20one%22),exit()),b=a.split(%22|%22),sz=b.length-1,base=b[0].split(%22$%22)[0]+(sz-1)+%22/M%22,c=b[sz].split(%22%23%22),sigh=c[c.length-1];var%20e=%22%22;for(t=ytplayer.config.args.length_seconds,n=Math.ceil(c[2]/(c[3]*c[4])),i=0;i%3Cn;i++)e+=%22%3CPICTURE='%22+base+i+%22.jpg%3Fsigh=%22+sigh+%22'%3E%3Cbr/%3E%22;var%20o=ytplayer.config.args.title;msg=%22%3Cbody%20style='background-color:%23444;color:%23eee;margin:20px%20auto;width:90%25;text-align:center'%3E%3Ch2%3ETITLE%3C/h2%3E%3Cdiv%3EIMAGES%3C/div%3E%3Cbr/%3E%3Cem%3E%3Ca%20href='http://labnol.org/%3Fp=28217'%20style='text-decoration:none;color:%23fff;font-style:bold'%3EPrinted%20using%20the%20YouTube%20bookmarklet.%3C/a%3E%3C/em%3E%3C/body%3E%22,msg=msg.replace(%22TITLE%22,o).replace(%22IMAGES%22,e).replace(/PICTURE/g,%22img%20src%22);var%20r=window.open();r.document.open(),r.document.write(msg),r.document.close()}();
<强>更新强>
这不在书签中,但实时环聊视频故事板被隐藏起来
ytplayer.config.args.live_storyboard_spec
例如{}
"https://i.ytimg.com/sb/xx/storyboard_live_60_3x3_b1/M$M.jpg?sigh=xx3f9uQQKI3j8yTiD2qO7_GynM8#106#60#3#3"