Nutch 使用metadata plugin捕获页面中的meta标签数据
生活随笔
收集整理的這篇文章主要介紹了
Nutch 使用metadata plugin捕获页面中的meta标签数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Nutch 使用metadata plugin捕獲頁面中的meta標簽數據
添加index-metadata和parse-metatags
要使用Nutch的插件,就需要在conf/nutch-site.xml中指定要使用的插件,插件的選取可以使用正則匹配去選取的,插件的nutch的根目錄下的apache-nutch-x.x/plugins文件夾中。
index-(basic|anchor|metadata)這句包含了index-metadata,index-anchor,index-basic。
parse-(html|metatags)這句包含了parse-html,parse-metatags
<!--具體需要什么插件,參考官方提供的plugins文件夾,不同版本包含的插件不同--> <property><name>plugin.includes</name><value>protocol-http|protocol-httpclient|urlfilter-regex|parse-(html|metatags)|index-(basic|anchor|metadata)|indexer-solr|query-(basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)</value><description>my Nutch plugin</description> </property>指定index-metadata需要的參數
需要獲取那些metatags的內容,可以配置下面這些參數。
<!-- Used only if plugin parse-metatags is enabled. --> <property> <name>metatags.names</name> <value>description,keywords</value> <description> Names of the metatags to extract, separated by ','.Use '*' to extract all metatags. Prefixes the names with 'metatag.'in the parse-metadata. For instance to index description and keywords,you need to activate the plugin index-metadata and set the value of theparameter 'index.parse.md' to 'metatag.description,metatag.keywords'. </description> </property>1.x版本
處理要配置要獲取的metatags的名字,還要配置metatags的解析字段名
<property><name>index.parse.md</name><value>metatag.description,metatag.keywords</value><description>Comma-separated list of keys to be taken from the parse metadata to generate fields.Can be used e.g. for 'description' or 'keywords' provided that these values are generatedby a parser (see parse-metatags plugin)</description> </property>2.x版本
在2.x中官方說明可以省略metatag.
<property><name>index.metadata</name><value>description,keywords</value><description>Comma-separated list of keys to be taken from the metadata to generate fields.Can be used e.g. for 'description' or 'keywords' provided that these values are generatedby a parser (see parse-metatags plugin), and property 'metatags.names'.</description> </property>添加metatags plugin需要fields
如果你需要在solr中建立索引,可以在solr的配置文件中添加以下字段
<!-- fields for the metatags plugin --> <field name="metatag.description" type="text" stored="true" indexed="true"/> <field name="metatag.keywords" type="text" stored="true" indexed="true"/>測試
可以用隨便一條網頁查看爬取解析的結果
#使用indexchecker檢查爬取解析處理的index ./bin/nutch indexchecker https://blog.csdn.net/qq_43203949/article/details/108550960#結果 fetching: https://blog.csdn.net/qq_43203949/article/details/108550960 parsing: https://blog.csdn.net/qq_43203949/article/details/108550960 contentType: text/html tstamp : Sun Jan 02 23:19:25 CST 2022 metatag.description : 解決Could not load dynamic library ‘cudnn64_7.dll’; dlerror: cudnn64_7.dll not found如果你使用的是tensorflow或 digest : 9f1bc7879417faaa87e82a7d65ca0cab host : blog.csdn.net id : https://blog.csdn.net/qq_43203949/article/details/108550960 title : 解決Could not load dynamic library ‘cudnn64_7.dll‘; dlerror cudnn64_7.dll not found_鴨梨的藥丸哥的博客-CSDN博客_c metatag.keywords : cudnn64_7.dll url : https://blog.csdn.net/qq_43203949/article/details/108550960 content : 解決Could not load dynamic library ‘cudnn64_7.dll‘; dlerror cudnn64_7.dll not found_鴨梨的藥丸哥的博客-CSDN博客_c 與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的Nutch 使用metadata plugin捕获页面中的meta标签数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 全瓷牙冠进口和国产的区别是什么
- 下一篇: nutch的index-writers.