0
我們試圖通過Google返回的搜索結果頁面的html來檢索圖像的最佳猜測。 我們知道圖像的最佳猜測具有類qb-b,所以我們嘗試使用.select方法選擇帶'a'標籤的元素。然而,當我們打印使用jsoup的get方法檢索到的文檔時,文檔不包含任何「最佳猜測」字符串。如何檢索來自html的圖像的最佳猜測google google jsoup
我們寫的代碼如下。我們如何解決它?
String newUrl = connect1.getHeaderField("Location");
Document doc = Jsoup.connect(newUrl.toString()).get();
Elements bestguess = doc.select("a.qb-b");
System.out.println(bestguess.toString());