Dennis
Dennis

Reputation: 137

Get informations from long string?

im currently trying to get a online status from a user on a website. Im able to get the website content into a string which shows me the online status of the users :

</path></g></svg><div class="name-2WpE7M">Friends</div></a></div><header>Direct Messages</header><div class="channel-2QD9_O selected-1HYmZZ" style="height: 42px; opacity: 1;"><a href="/channels/@me/504918247850639363"><div class="wrapper-2F3Zv8 small-5Os1Bb forceDarkTheme-2cI4Hb avatar-small"><div user="Dennis" status="online" class="avatar-small stop-animation" style="background-image: url(&quot;/assets/322c936a8c8be1b803cd94861bdfa868.png&quot;);"></div><div class="online-2S838R status-oxiHuE small-5Os1Bb status"></div></div><span class="name-2WpE7M">Dennis</span><button class="close-3hZ5Ni"></button></a></div></span></div></div></div><div class="container-2Thooq"><div class="wrapper-2F3Zv8 small-5Os1Bb avatar-small"><div user="halaldi" status="online" class="avatar-3JE4B3 avatar-small stop-animation" style="background-image: url(&quot;/assets/0e291f67c9274a1abdddeb3fd919cbaa.png&quot;);"></div><div class="online-2S838R status-oxiHuE small-5Os1Bb status status-2kJpnA"></div></div><div class="accountDetails-3k9g4n nameTag-m8r81H"><span

https://pastebin.com/Hb1mp1fq search for status="online" and you will find here 2 users which are online.

But here comes the part where im stuck, whats the best way to get those informations out of the string? I could split the string down until i only have the parts left which i need, but i guess that stupid and not the best way to do it, so i would love to learn a new and better way for this :)

Upvotes: 0

Views: 44

Answers (1)

Hagay Goshen
Hagay Goshen

Reputation: 669

It seems your data is HTML based.

If so you can use HTML parsing library like :

https://www.nuget.org/packages/HtmlAgilityPack

It provies many ways to parse HTML (by tags, css etc).

Upvotes: 1

Related Questions