How to get all my desired links from a html page
if suppose im having youtube homepage(www.youtube.com) which contains numerous links, i want to get all the link of youtube videos alone and it must be stored in a array.. it contains around 10 videos i want 10 videos link in array.. how can i do it???


Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 25, 2013, 12:44 AM EDT
Try like this,
WebClient client = new WebClient();
string downloadString = client.DownloadString("http://www.youtube.com");
string strRegex = @"(?i)]+)>(.+?)";
RegexOptions myRegexOptions = RegexOptions.IgnoreCase | RegexOptions.Multiline;
Regex myRegex = new Regex(strRegex, myRegexOptions);
foreach (Match myMatch in myRegex.Matches(downloadString))
{
if (myMatch.Success)
{
// Add your code here
}
}
Prasanth R21 reputationPosted Oct 25, 2013, 1:21 AM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 25, 2013, 3:52 AM EDT
Prasanth R21 reputationPosted Oct 25, 2013, 11:15 PM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 26, 2013, 5:22 AM EDT
if(urlValue.Contains("youtube.com"))
{
//Code goes here
}