我是 crawler4j 的新手。我将网站爬网到一定深度并找到了我搜索的内容。我现在要做的是追溯我的步骤并找出我是如何进入这个页面的。我需要一个链接列表,这些链接将我带到我正在寻找的内容所在的页面。
我的尝试是更改爬虫中的访问方法
@Override
public void visit(Page page) {
String url = page.getWebURL().getURL();
// condition for content found
boolean contentFound = false;
// compute 'content found' here
if (contentFound) {
System.out.println(page.getWebURL().getParentUrl());
getMyController().shutdown();
}
}
这只会给我一个父 url 的字符串。
page.getWebURL().getParentDocid();
只给我父的文档ID,但我怎样才能找到这个页面的父?
谢谢!