use*_*272 10 web-crawler nutch
我正在寻找一个抓文章的框架,然后我找到了Nutch 2.1.以下是我的计划和问题:
1
将文章列表页面添加到url/seed.txt这是一个问题.我真正想要编入索引的是文章页面,而不是文章列表页面.但是,如果我不允许将列表页面编入索引,Nutch将不执行任何操作,因为列表页面是入口.那么,如何在没有列表页面的情况下仅索引文章页面?
2
编写一个插件来解析'作者','日期','文章正文','标题'以及html中的其他信息.Nutch 2.1中的'Parser'插件接口是:Parse getParse(String url,WebPage页面)和'WebPage'类有一些预定义的attributs:
public class WebPage extends PersistentBase {
// ...
private Utf8 baseUrl;
// ...
private ByteBuffer content; // <== This becomes null in IndexFilter
// ...
private Utf8 title;
private Utf8 text;
// ...
private Map<Utf8,Utf8> headers;
private Map<Utf8,Utf8> outlinks;
private Map<Utf8,Utf8> inlinks;
private Map<Utf8,Utf8> markers;
private Map<Utf8,ByteBuffer> metadata;
// ...
}
So, as you can see, there are 5 maps I can put my specified attributes in. But, 'headers', 'outlinks', 'inlinks' seem not used for this. Maybe I could put those information into markers or metadata. Are they designed for this purpose?
BTW, the Parser in trunk looks like: 'public ParseResult getParse(Content content)', and seems more reasonable for me.
Run Code Online (Sandbox Code Playgroud)
3
将文章索引到Solr后,另一个应用程序可以通过'date'查询它,然后将文章信息存储到Mysql中.我的问题是:Nutch可以将文章直接存储到Mysql中吗?或者我可以编写一个插件来指定索引行为吗?
Nutch对我的目的来说是个不错的选择吗?如果没有,你们为我建议另一个优质的框架/图书馆吗?谢谢你的帮助.
小智 1
如果您只需要从几个网站中提取文章,请查看http://www.crawl-anywhere.com/
它带有一个管理用户界面,您可以在其中指定要使用boilerpipe文章提取器(这很棒)。您还可以通过 URL 模式匹配要爬网的页面以及要爬网和索引的页面来指定。