<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 從一個URL加載一個Document <div><h2>存在問題</h2> <p>你需要從一個網站獲取和解析一個HTML文檔,并查找其中的相關數據。你可以使用下面解決方法:</p> <h2>解決方法</h2> <p>使用 <code><a title="Creates a new Connection to a URL." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#connect%28java.lang.String%29">Jsoup.connect(String url)</a></code>方法:</p> <pre><code>Document doc = Jsoup.connect("http://example.com/").get(); String title = doc.title(); </code></pre> <h2> 說明 </h2> <p><code><a title="Creates a new Connection to a URL." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#connect%28java.lang.String%29">connect(String url)</a></code> 方法創建一個新的 <code><a title="A Connection provides a convenient interface to fetch content from the web, and parse them into Documents." href="http://jsoup.org/apidocs/org/jsoup/Connection.html">Connection</a></code>, 和 <code><a href="http://jsoup.org/apidocs/org/jsoup/helper/HttpConnection.html#get%28%29">get()</a></code> 取得和解析一個HTML文件。如果從該URL獲取HTML時發生錯誤,便會拋出 IOException,應適當處理。</p> <p><code><a title="A Connection provides a convenient interface to fetch content from the web, and parse them into Documents." href="http://jsoup.org/apidocs/org/jsoup/Connection.html">Connection</a></code> 接口還提供一個方法鏈來解決特殊請求,具體如下:</p> <pre><code>Document doc = Jsoup.connect("http://example.com") .data("query", "Java") .userAgent("Mozilla") .cookie("auth", "token") .timeout(3000) .post(); </code></pre> <p>這個方法只支持Web URLs (<code>http</code>和<code>https</code> 協議); 假如你需要從一個文件加載,可以使用 <code><a title="Parse the contents of a file as HTML." href="http://jsoup.org/apidocs/org/jsoup/Jsoup.html#parse%28java.io.File,%20java.lang.String%29">parse(File in, String charsetName)</a></code> 代替。</p><br></div>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看