I'm trying to find all the youtube video ID's from a playlist source. But i'm not too familiar with Regex so it's quite difficult for me.
This is my current code:
Console.Write("Playlist? Ex: \"PLaJlh8L9CwotfVy6fAtlphD_JD6IgSTMx\": ");
string playlist = Console.ReadLine();
string source = client.DownloadString("http://www.youtube.com/playlist?list=" + playlist);
Regex reg = new Regex(".*?href=\"/watch\\?v=(?<vid>.+?)&list="+ playlist);
MatchCollection mc1 = reg.Matches(source);
foreach (Match m in mc1)
{
string vid = m.Groups["vid"].Value;
Console.WriteLine(m);
Console.ReadLine();
}
I want it to loop through the source and display every video ID it finds in the source. Example of a video ID is "EzuvVs953Gs" in "https://www.youtube.com/watch?v=EzuvVs953Gs"
So far it does display everything that contains a video ID but it displays the entire line. I want it to only display the ID. I also want it to be able to check if it already found the ID. If it did, it will skip to the new one so it doesn't display it more than one time.