0

I'm trying to get data with httpwebrequest its ok with stable datas which is not changing every second.

But when i'm trying to get a timer(which actually changes everysecond as u know) I'm not getting time data.I think it happens because im trying to get this from a html document but when i inspect page source i see this

<td class="desc ausbau">Yükselt                     <span class="level">Kademe 7</span>
                </td>
            </tr>
            <tr class="data">
                <td class="desc">Süre:</td>
            </tr>
            <tr class="data">
                <td class="desc timer">
                    <span id="Countdown">Yükleniyor...</span>
                </td>
            </tr>
            <tr class="data">
                <td colspan="2">

Yükleniyor... = Loading...

I think this happens because javascript enables itself when html document is completed.And real data is in the javascript counting minutes and seconds as you see below in screenshot...

http://prntscr.com/neci3b

Here is my code block im working with...

System.Net.CookieContainer myCookies = new System.Net.CookieContainer();
                bool result = HttpMethods.Post("https://lobby-api.ogame.gameforge.com/users", postData, "https://tr.ogame.gameforge.com/", myCookies);                
Console.WriteLine("Giris Basarili!");

                string mySrc = HttpMethods.Get("https://lobby-api.ogame.gameforge.com/users/me/loginLink?id=103960&server[language]=tr&server[number]=157", "https://lobby.ogame.gameforge.com/tr_TR/?language=tr", myCookies);
                string token = GetBetween(mySrc, "token=", "\"}"); // Sayfa kaynağından token kodunu ayıkladık.
                string veri = "https://s157-tr.ogame.gameforge.com/game/lobbylogin.php?id=103960&token=" + token + ""; //Tokenli Link
                string mySrc2 = HttpMethods.Get(veri, "https://lobby.ogame.gameforge.com/tr_TR/?language=tr", myCookies); //Tokenli Link ile giriş.
                Console.WriteLine(mySrc2); // Aldığımız sonucu konsola yazdık

http://prntscr.com/neciwo

Here is dynamic timer data im trying to get.But im failling everytime becuse its not giving me javascript data.Is there any way to get dynamic data from this?

Pandorax
  • 13
  • 4
  • 1
    An HTTP request is only going to give you the response. It's not a substitute for a web browser. It sounds like what you may be looking for is called a "headless browser". It's an in-code component which functions like a web browser, including JavaScript execution, but just has no UI. This question is pretty old, but could be a good place to get started: https://stackoverflow.com/questions/10161413/headless-browser-for-c-sharp-net – David Apr 19 '19 at 21:57
  • Using httpagility pack will solve my problem? Or i need to use browser in my project? – Pandorax Apr 19 '19 at 22:39

0 Answers0