public LyricSearchResultCollection Search(string sText) { string lUrl = "http://www.lyricsfairy.com/search.php?q=" + sText; string lHtml = HttpHelper.MakeWebRequest(lUrl); // extract list of song matches Regex lRegex = new Regex(@"face=""Arial"">Song list</font>[\s\S]{1,100}<ul class=""text"">[\s\S]{1,100}(<li>[\s\S]*?</li>[\s\S]{1,100}?)+[\s\S]{1,100}</ul>"); Match lMatch = lRegex.Match(lHtml); LyricSearchResultCollection lResults = new LyricSearchResultCollection(); foreach (Capture lCapture in lMatch.Groups[1].Captures) { Regex lSongRegex = new Regex(@"<a href=""([\s\S]{1,200}?)""><b>([\s\S]{1,200}?)</b>[\s\S]{1,200}?"">([\s\S]{1,200}?)</a>"); Match lSongMatch = lSongRegex.Match(lCapture.Value); // now extract individual song from html LyricSearchResult lResult = new LyricSearchResult(); lResult.Artist = lSongMatch.Groups[3].Value; lResult.Album = string.Empty; lResult.Song = lSongMatch.Groups[2].Value; lResult.Url = lSongMatch.Groups[1].Value; lResults.Add(lResult); } return lResults; }
public void Remove(LyricSearchResult lResult) { List.Remove(lResult); }
public void Insert(int index, LyricSearchResult lResult) { List.Insert(index, lResult); }
public bool Contains(LyricSearchResult lResult) { return List.Contains(lResult); }
public int Add(LyricSearchResult lResult) { return List.Add(lResult); }