mardi 29 janvier 2019

How can I get a number using c# and webscraping?

Basically I am creating a program that gets the number of accounts for sale in specific games on playerauctions. I need help with the webscraping aspect of it and getting the actual number into a list.

namespace Web_Scraping___Playerauctions { class Program { static void Main(string[] args) { GetHtmlAsync(); }

    private static async void GetHtmlAsync()
    {
        var url = "https://www.playerauctions.com/fortnite-account/";

        var httpClient = new HttpClient();
        var html = await httpClient.GetStringAsync(url);

        var htmlDocument = new HtmlDocument();
        htmlDocument.LoadHtml(html);

        var Products = htmlDocument.DocumentNode.Descendants("ul")
            .Where(node => node.GetAttributeValue("li", "")
            .Equals("span.Account")).ToList();

        Console.WriteLine();
        Console.ReadLine();
    }
}

}

I just threw a fortnite link in just because. So on the website when you look at the tabs for items leveling and accounts, it tells you how many accounts there are and thats what I want to get.




Aucun commentaire:

Enregistrer un commentaire