[+] Encapsulate function to get vid from youtube url
This commit is contained in:
+16
@@ -172,3 +172,19 @@ export default class App extends Vue
|
||||
this.$refs.ps.show(this.swipeItems(), {index: index});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get VID from youtube url
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
function getYoutubeVID(url: string)
|
||||
{
|
||||
let video_id = url.split('v=')[1];
|
||||
let ampersandPosition = video_id.indexOf('&');
|
||||
if(ampersandPosition != -1)
|
||||
{
|
||||
video_id = video_id.substring(0, ampersandPosition);
|
||||
}
|
||||
return video_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user