【问题标题】:regex_search: could not find match for (?:v=|\/)([0-9A-Za-z_-]{11}). when i add in youtube link (start=seconds) in djangoregex_search:找不到 (?:v=|\\/)([0-9A-Za-z_-]{11}) 的匹配项。当我在 django 中添加 youtube 链接(start=seconds)时
【发布时间】: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


    【解决方案1】:

    我想,如果你不清楚,我们帮不了你。正则表达式在哪里?

    (?:v=|/)([0-9A-Za-z_-]{11}).*
    

    使用这些正则表达式的代码在哪里?

    【讨论】:

    • 这是评论,不是答案。
    猜你喜欢
    • 2022-08-15
    • 1970-01-01
    • 2021-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-28
    • 1970-01-01
    相关资源
    最近更新 更多