Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private string GetYouTubeVideoID(string lnk)
- {
- if (lnk.Contains("youtube.com") ||
- lnk.Contains("youtu.be"))
- {
- Regex YT = new Regex(@"youtu(?:\.be|be\.com)/(?:.*v(?:/|=)|(?:.*/)?)([a-zA-Z0-9-_]+)");
- Match youTube = YT.Match(lnk);
- if (youTube.Success)
- {
- _linkType = "youtube";
- return youTube.Groups[1].Value;
- }
- _linkType = "url";
- return lnk;
- }
- _linkType = "url";
- return lnk;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement