我尝试使用Jsoup来获取ACM-DL文章摘要。但却没能得到
这是网站:http://dl.acm.org/citation.cfm?id=1999265&coll=DL&dl=GUIDE&CFID=698338637&CFTOKEN=48876455
这是我的代码部分
Elements PapaerElm = PaprtDoc.select("div div div p");
for(Element tempAbstract :PapaerElm){
System.out.println(tempAbstract);
}我如何才能正确地获取摘要?
谢谢。
发布于 2015-08-04 22:28:48
因为div的id是“抽象的”,所以你可以这样做:
Element content = document.getElementById("abstract");然后解析元素以获得div中的段落:
Elements paragraphs = content.getElementsByTag("p");然后迭代以找到所需的摘要。
发布于 2015-08-05 21:14:53
摘要是通过AJAX调用加载的。我使用Chrome网络工具提取了这个直接URL:
http://dl.acm.org/tab_abstract.cfm?id=1999265所以看起来id来自于你的原始URL。(我去掉了其他东西,包括令牌,因为似乎不需要它来获得摘要)
https://stackoverflow.com/questions/31811945
复制相似问题