//public string GetId(string pageurl) //{ // string Html = GetHtml(pageurl); // return GetVideolist(Html)[0]; //} private string[] GetVideolist(string Html) { string pattern = @"data-context-item-id=""(?<Videoid>.[^""]*)"""; //Console.WriteLine(pattern); Regex reg = new Regex(pattern, RegexOptions.IgnoreCase); MatchCollection Videolist = reg.Matches(Html); string[] VideoIdlist = new string[Videolist.Count]; int index = 0; foreach (Match VideoId in Videolist) { string Videoidt = VideoId.Result("${Videoid}"); VideoIdlist[index++] = Videoidt; //Console.WriteLine(Videoidt); } return(VideoIdlist); }