【发布时间】:2012-04-11 21:39:24
【问题描述】:
我正在使用 JSoup 从亚马逊的特定网页中检索评论,而我现在拥有的是:
Document doc = Jsoup.connect("http://www.amazon.com/Presto-06006-Kitchen-Electric-Multi-Cooker/product-reviews/B002JM202I/ref=sr_1_2_cm_cr_acr_txt?ie=UTF8&showViewpoints=1").get();
String title = doc.title();
Element reviews = doc.getElementById("productReviews");
System.out.println(reviews);
这给了我包含评论的 html 块,但我只想要没有所有标签 div 等的文本。然后我想将所有这些信息写入文件。我怎样才能做到这一点?谢谢!
【问题讨论】:
-
Jsoup 有很多用于提取信息的工具,而且您肯定已经阅读过这些教程(它们并不大)。那么,在这点上,您尝试过什么,您在哪里卡住了?