📜  vaidate youtube url - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:56.047000             🧑  作者: Mango

代码示例1
function matchYoutubeUrl(url) {
    var p = /^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
    if(url.match(p)){
        return url.match(p)[1];
    }
    return false;
}