【发布时间】:2023-01-10 11:50:14
【问题描述】:
我目前正在使用 Django 开发一个嵌入 youtube 视频的项目。我也使用 javascript,但是当我使用 javascript 在 youtube 链接中添加一些参数时,例如 https://www.youtube.com/embed/T6xslkut6JA?start=4 出现错误 regex_search: could not find a match for (?:v=|/)([0-9A-Za-z_ -]{11}).我花了很多时间,但找不到任何解决方案 这是我的javascript代码:
<script>
let H;
url = document.getElementById("url").innerHTML;//decleare url that get youtube link
vedio = document.getElementById("vedio");// id that declear in <embed > tag
function myFunction(value) {//value is in millisecond this function convert millisecond in second
console.log("clicked");
console.log(value);
var seconds = ((value % 60000) / 1000).toFixed(0);
H = url+"?start="+seconds;
console.log(url);
vedio = document.getElementById("vedio").src = "H";
console.log(H);
}
</script>
这是我得到的错误
【问题讨论】:
标签: javascript django youtube embed pytube