% function get_youtube_id(url) { var regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; var match = url.match(regExp); if (match && match[2].length == 11) { return match[2]; } else { return false; } } function get_vimeo_id(url) { var regExp = /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/; var match = url.match(regExp); if (match){ return match[2]; } else { return false; } } function get_dailymotion_id(url) { var regExp = /^(?:(?:http|https):\/\/)?(?:www.)?(dailymotion\.com|dai\.ly)\/((video\/([^_]+))|(hub\/([^_]+)|([^\/_]+)))$/; var match = url.match(regExp); if (match) { if(match[4] !== undefined) { return match[4]; } return match[2]; } return false; } function get_facebook_id(url) { var regExp = /^https?:\/\/www\.facebook\.com\/(?:video\.php\?v=\d+|.*?\/videos\/\d+)\/?$/; var match = url.match(regExp); if (match) { return encodeURIComponent(url); } return false; } %>