I need a function that can get the video ID from both Vimeo and YouTube urls.
I have done some digging and found these urls:
https://vimeo.com/30466080
https://vimeo.com/30466080#t=0
http://www.youtube.com/watch?feature=player_detailpage&v=My2FRPA3Gf8 http://www.youtube.com/watch?v=My2FRPA3Gf8
//www.youtube.com/v/My2FRPA3Gf8?version=3&hl=en_GB
//www.youtube-nocookie.com/v/My2FRPA3Gf8?version=3&hl=en_GB //www.youtube.com/embed/My2FRPA3Gf8
Vimeo, really only has one kind and is always in the same position.
YouTube however is safe to say that their 64bit id algorithm won't be changing anytime soon, so the 11 character count it safe to assume always.
I'm wondering what's the best way to tackle this rather than chaining 6 or 7 different if commands?
Shannon