Bookmarklet可嵌入带参数的YouTube页面

Bookmarklet to embed YouTube page with parameters

本文关键字:YouTube 页面 参数 Bookmarklet      更新时间:2023-09-26

我当前的代码提取YouTube视频的视频ID,并将其嵌入到自己的页面上:

document.location = 'http://www.youtube.com/embed/' + document.location.href.match(/[&?]v=([^&#]*)/i)[1]

我想添加代码,在视频ID后添加三个YouTube参数"?modestbranding=1&rel=0&autoplay=1",使其变为:

http://www.youtube.com/embed/[VIDEOID]?modestbranding=1&rel=0&autoplay=1

如何做到这一点?

只需要添加到文档的其余部分。位置分配:

document.location = 'http://www.youtube.com/embed/' + document.location.href.match(/[&?]v=([^&#]*)/i)[1] + "?modestbranding=1&rel=0&autoplay=1"