Deutsch
Germany.ruФорумы → Архив Досок→ Программирование

HtmlAgilityPack HtmlWeb load() throws an exception

17.08.18 22:20
Re: HtmlAgilityPack HtmlWeb load() throws an exception
 
MrSanders старожил
в ответ moose 15.08.18 22:22

java 1.8, нет сейчас линукса с перлом под рукой.

package test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class Reader {

    public static void main(final String[] args) throws IOException {
        final URL totoUrl = new URL("https://www.westlotto.com/wlinfo/WL_InfoService?gruppe=SpielplanToto&client=wlincl");
        BufferedReader reader = new BufferedReader(new InputStreamReader(totoUrl.openStream()));
        String line = null;
        do {
            line = reader.readLine();
            System.out.println(line);
        }while(line!=null);
    }
}

Скачивает содержимое:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta name="Audience"                    content="Alle">
    <meta name="Author"                        content="Westdeutsche Lotterie GmbH & Co. OHG">
    <meta name="Copyright"                    content="Westdeutsche Lotterie GmbH & Co. OHG">
    <meta name="Description"                content="Ergebnisse, Gewinnzahlen und Quoten fьr Lotto, KENO, GlücksSpirale, ODDSET KOMBI-Wette, ODDSET-TOP-Wette, Auswahlwette, Ergebiswette und NKL. Hier finden Sie alle Lottozahlen online.">
    <meta name="Language"                    content="de">
    <meta name="Publisher"                    content="Westdeutsche Lotterie GmbH & Co. OHG">

    <meta http-equiv="Content-Language"        content="de">
    <meta http-equiv="Content-Script-Type"    content="text/javascript">
    <meta http-equiv="Content-Style-Type"    content="text/css">
    <meta http-equiv="Content-Type"            content="text/html;charset=ISO-8859-15">

    <link rel="stylesheet" href="/infoservice/wlincl/styles/spielplan-toto.css"  type="text/css" media="all"    title="Westdeutsche Lotterie GmbH & Co. OHG">

    <title>TOTO-Spielplan und Ergebnisse</title>
</head>
<body>
<div id="page">
    <div class="headline">
        <div class="edge_top_left">
            <div class="edge_right"></div>
        </div>
        <div class="headline_text">
            <div class="headline_indent">
                <h1>TOTO-Spielplan vom 18.08.2018 bis 19.08.2018 (33. Ausspielung)</h1>
            </div>
        </div>
        <div class="edge_bottom_left">
            <div class="edge_right"></div>
        </div>
    </div>

и те де

Может проблема в том, с каким IP устанавливается соединение. Для

nslookup www.westlotto.com

Non-authoritative answer:
Name: a10-vip-wlcom.westlotto.de
Addresses: 2003:8:10:2:0:a10:afe6:42b7
194.25.144.211
Aliases: www.westlotto.com


и IPv6 и IPv4 занесены. Проверьте wireshark-ом куда запросы от браузера и от шарпа идут.

 

Перейти на