我正在尋找一個框架來抓取文章,然後我找到Nutch 2.1。這是我的計劃,問題在每個:如何擴展Nutch文章抓取
添加文章列表頁面URL進入/ seed.txt 這裏有一個問題。我真正想要索引的是文章頁面,而不是文章列表頁面。但是,如果我不允許將列表頁面編入索引,Nutch將不會執行任何操作,因爲列表頁面是入口。那麼,我怎樣才能索引沒有列表頁面的文章頁面呢?
寫一個插件來解析出「作者」,「日期」,「文章正文」,「標題」,並從HTML也許其他信息。 在Nutch的2.1 '分析器' 插件接口: 解析getParse(字符串URL,網頁頁面) 和 '好康' 類有一些預定義的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.
的文章後索引到Solr中,另一個應用程序可以通過'date'查詢它,然後將文章信息存儲到Mysql中。 這裏我的問題是:Nutch可以直接將文章存儲到Mysql中嗎?或者我可以編寫一個插件來指定索引行爲?
Nutch是我的目的不錯的選擇嗎?如果沒有,你們會爲我建議另一個高質量的框架/庫嗎? 感謝您的幫助。
Inside Crawl Anywhere文檔我無法找到功能,通過它可以指定僅提取文章正文(而不是整個html網頁正文)。 –