2017-09-03 9 views
0

ウェブサイトのC#のボディから:プログラムが何も実行されませんこすりInnerTextプロパティ私はこのウェブサイトからデータを収集しようとしている

using HtmlAgilityPack; 
using System; 

var webGet = new HtmlWeb(); 
var document = webGet.Load("http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympy"); 
var bodyText = document.DocumentNode.SelectNodes("/html/body/text()"); 
Console.WriteLine(bodyText); 
Console.ReadLine(); 

http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympyがコンソールに出力され、エラーが発生していません。

screenshot of the console

私は何ものXPathで発見されていないことを推測している「/ HTML /ボディ/テキスト()」、私はこれを固定周りに行くことができますどのように任意のアイデア?

答えて

1

あなたのページは純粋なテキストです。だから、HtmlAgilityPackのようなツールは必要ありません。ちょうどそれをダウンロードして使用してください。

using (var wc = new WebClient()) 
{ 
    var bodyText = wc.DownloadString("http://services.runescape.com/m=hiscore_oldschool/index_lite.ws?player=f2pshrympy"); 

} 
関連する問題