O
O
okalash2019-06-20 23:35:42
HTML
okalash, 2019-06-20 23:35:42

C# parsing via AngleSharp?

There is this table:

</iron-icon></paper-icon-button></div><span class="column-content tooltip"><img src="./New - Google Play Музыка_files/unnamed.jpg" alt="">HUMBLE.</span></td><td data-col="duration"><span>2:57</span></td><td data-col="artist" data-matched-id="Ag6icjgrnuaumrdrubtg5nr2xki"><span class="column-content tooltip"><a class="text" href="https://play.google.com/music/listen" aria-label="Исполнитель: Кендрик Ламар">Кендрик Ламар</a></span></td><td data-col="album" data-album-artist="Кендрик Ламар" data-matched-id="Bwj4cpxbxjnarequw2jkj5c3a5u"><span class="column-content tooltip"><a class="text" href="https://play.google.com/music/listen" aria-label="Альбом: DAMN.">DAMN.</a></span></td><td data-col="play-count"><span>54</span></td>

How do I get the title, album, etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FaNaT, 2019-06-24
@fanat_96

I have never worked with AngleSharp, but with the help of HtmlAgillityPack and xpath queries, you can pull out the necessary data. For example, for the name it will be like this:

HtmlAgilityPack.HtmlDocument HD = new HtmlAgilityPack.HtmlDocument();
HD.LoadHtml(тут ваш код страницы);
var title = HD.DocumentNode.SelectSingleNode("//span/img/..");
MessageBox.Show(title.InnerText);

I wrote without a studio, I could make a mistake somewhere.
In general, you can refer to the value of data-col (If there is one in the loaded DOM). That is, like this:
//td[@data-col='duration']/span

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question