Skip to content

Instantly share code, notes, and snippets.

@w3core
w3core / youtube-vimeo-url-parser.js
Last active November 11, 2020 09:00 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - http://y2u.be/huKvjPQ-Xm4
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - http://www.youtube.com/embed/Ab25nviakcw
// - http://www.youtube-nocookie.com/v/Ab25nviakcw?version=3&hl=en_US
// - http://www.youtube.com/watch?feature=player_embedded&v=Ab25nviakcw#
// - Supported Vimeo URL formats: