parse text from class of complex html file

Topics: User Forum
Oct 13, 2014 at 6:02 AM
Edited Oct 13, 2014 at 6:05 AM
First of all I'm a beginner in programming.

I just want to get the text of a class from a html file (website).

Here is the html code (the selected class "lyrics-body"):

And my code:
String strLyricsWebsite = "";
String strInterpReplace = strInterp.Replace(" ", "_");
String strSongReplace = strSong.Replace(" ", "_");
String strUrlZusammen = String.Concat(strLyricsWebsite, strSongReplace, "_lyrics_", strInterpReplace, ".html");

lblUrlTest.Text = strUrlZusammen;

                    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                    HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[@class='lyrics-body']");
                    string webText = node.InnerText;

                    strPfadDatei = webText;
whats the problem with my code ?
the program is crashing with that code.

Why is there such an easy command for an ID ( GetElementbyID) but not for a class ? :/

I've searched for hours for a resolution but nothing worked :(
Remember: I'm a total beginner in programming^^

Sorry for my bad english
Hope you can help me