I am making a little youtube app but there is one problem. I get 2 kind of youtube url's and both are not able to embed. So i have to change them. Now my logic is to extract the youtube video code out of the URL. The 2 links i get are as follows:
https://youtu.be/TbvMgLDVUd4 -> i need the TbvMgLDVUd4
https://www.youtube.com/watch?v=72yuprTXvMI-> i need the 72yuprTXvMI
So my idea is something like this but i have no idea how to exactly make this...
if (videos.results[i].titlemay_link === https://www.youtube.com/watch?v=.........) {
var output = only get the ..........
} else {
var output = only get the ..........
}
content += '<iframe width="560" height="315" src="' + outcome + '" frameborder="0" allowfullscreen></iframe>';