从已更改的网站更新已解析值的最佳方法是什么? (JSOUP)

时间:2017-11-27 23:43:30

标签: java jsoup

有没有简单的方法来更新元素或字符串的值?例如:

Connection.Response getPrice = Jsoup.connect("https://quadrigacx.com/market")
                     .userAgent("Mozilla")
                     .cookies(loginCookies)
                     .method(Connection.Method.GET)
                     .execute();`

             Timer t = new Timer();
             t.scheduleAtFixedRate(new TimerTask(){
                 @Override
                 public void run() {
                     try {
                         String firstBO = getPrice.parse().select("table[class=table table-hover table-condensed table-striped table-orders bids]>tbody>tr").get(0).attr("data-rate");
                         String firstSO = getPrice.parse().select("table[class=table table-hover table-condensed table-striped table-orders asks]>tbody>tr").get(0).attr("data-rate");
                         jTextPane1.setText(jTextPane1.getText()  + "Buy Order: $" + firstBO + "\n"); //doesnt get updated price
                         jTextPane1.setText(jTextPane1.getText()  + "Sell Order: $"+ firstSO + "\n");
                     } catch (IOException ex) {
                         Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
                     }`

或者我是否必须执行另一个Jsoup.connect来获取新值?

0 个答案:

没有答案