亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用android將web javascript內容解析為字符串

使用android將web javascript內容解析為字符串

達令說 2023-07-06 14:53:00
我想將網站的內容讀入字符串中。我開始使用jsoup如下:private void getWebsite() {    new Thread(new Runnable() {        @Override        public void run() {            final StringBuilder builder = new StringBuilder();            try {                String query = "https://merhav.nli.org.il/primo-explore/search?tab=default_tab&search_scope=Local&vid=NLI&lang=iw_IL&query=any,contains,???? ????";                Document doc = Jsoup.connect(query).get();                String title = doc.title();                Elements links = doc.select("div");                builder.append(title).append("\n");                for (Element link : links) {                    builder.append("\n").append("Link : ").append(link.attr("href"))                            .append("\n").append("Text : ").append(link.text());                }            } catch (IOException e) {                builder.append("Error : ").append(e.getMessage()).append("\n");            }            runOnUiThread(new Runnable() {                @Override                public void run() {                    tv_result.setText(builder.toString());                }            });        }    }).start();}然而,問題是,在這個網站中,當我使用 Chrome 等網絡瀏覽器時,它在其中一行中顯示:window.appPerformance.timeStamps['index.html']= Date.now();</script><primo-explore><noscript>JavaScript must be enabled to use the system</noscript><style>.init-message {所以我讀到jsoup對于這種情況沒有一個好的解決方案。有沒有什么好的方法來獲取這個頁面的元素,即使它使用了javascript?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 157 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號