-1

I play on a private WoW server and i want to get the player names from the Website.

I tried with the DownloadString method but it doesn't works.

Here is the link: /information#allrealm but I can get the source just from /information. It does not consider the #allrealm tag. So I can't get the player names.

How can I get the source code from the website using the #allrealm tag?

Weper
  • 21
  • 2

1 Answers1

1

The details of the users are loaded by an Ajax call as you can see if you open the Developer Tools of your webbrowser:

developer tools showing ajax calls

You need to fed the DownloadString method with that XHR url:

using(var wc = new WebClient())
{
    wc.Encoding = Encoding.UTF8;
    var all = wc.DownloadString("https://tauriwow.com/allrealm/ajax");
    Console.WriteLine(all);
}

The content you get is html, so you have to do the parsing of that by yourself, maybe using a library like CsQuery

When you run above snippet this is what you get:

<div class="lft realmBox realmBoxFirsts">
    <div class="realmTitle">
        <div class="subtitle"><div class="lft"><b>&raquo;</b></div><div class="lft subtitle2">Tauri WoW Server</div><div class="rgt realmType">RPPvP</div></div>
    </div>
        <div class="realmStats"><a href="/allrealm/12">Detailed statistics</a></div>
        <div class="realmDetails">
                                            1) Acélember (<font style="color: lightblue;">20</font>)<br />2) Adjádékát (<font style="color: lightblue;">1</font>)<br />3) Adoresta 
Community
  • 1
  • 1
rene
  • 41,474
  • 78
  • 114
  • 152