lundi 31 juillet 2017

Why C# doesn't download whole source code from webpage?

I am writing a simple program which shows me station name and song title. Also my program will look for stream link. Everything works except looking for stream link. In browser there id word like "preload" but in C# no. What can I fix?

using System;
using System.Net;

namespace Web    
{
  class Program
  {
    static void Main(string[] args)
    {
        string rock = "http://ift.tt/2udlcFQ";

        string r;
        WebClient web = new WebClient();
        string html = web.DownloadString(rock);

        int radio = html.IndexOf("default__titleOffset___yb9ja guide-item__guideItemListTitle" +
            "___2oNg0 guide-item__guideItemTitle___VBHQg guide-item__truncate___2jSzt") + 152;

        html = html.Remove(0, radio);

        int title = html.IndexOf("default__titleOffset___yb9ja guide-item__guideItemListSubtitle" +
            "___3Hczj guide-item__guideItemSubtitle___2hQxF guide-item__truncate___2jSzt") + 158;

        radio = html.IndexOf("</div>");

        r = html.Remove(radio);

        Console.WriteLine(r);

        html = html.Remove(0, title);

        title = html.IndexOf("</p>");

        html = html.Remove(title);

        Console.WriteLine(html);
        Console.WriteLine("-------------------------------------------------------------");

        string coppy = web.DownloadString(rock);

        int k = coppy.IndexOf("preload");

        Console.WriteLine(k); //it outputs -1 
    }
 }
}

There is my problem on photo




Aucun commentaire:

Enregistrer un commentaire