c# - HtmlAgilityPack不从网页中提取任何数据

时间:2016-05-23 21:48:21

标签: c# html parsing xpath

我正在尝试编写这个脚本,从steam api中提取我的统计数据。我遵循了许多其他教程,并且我的代码主要基于这些帖子:Parsing HTML page with HtmlAgilityPackC# - How do I get the URL of an icon from Steam Trading API (encoded)但是当我运行我的项目时,它只返回一个空白屏幕,没有错误代码或任何内容。这是源代码:

using HtmlAgilityPack;
using System;
using System.Xml.XPath;

namespace csgo_stats
{
    class Program
    {
        static void Main(string[] args)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml("http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&steamid=76561197972495328");
            XPathNavigator docNav = doc.CreateNavigator();
            XPathNavigator stats = docNav.SelectSingleNode("/html/body/pre");
            Console.WriteLine(stats);
            Console.ReadKey(); 
        }

    }
}

0 个答案:

没有答案