[Nutch]如何利用HTML页面中meta元素?

news/2024/7/2 23:03:30

[Nutch]如何利用HTML页面中meta元素?[郑昀]

1:假如说你的站点页面中有这么一句:

你利用Nutch抓取并分析时,如何得到这个meta数值并处理呢?

2:你可以从HtmlParseFilter扩展出一个RobotsParserFilter,用下面的代码得到meta值:

Properties generalMetaTags = metaTags.getGeneralTags();
String robots = generalMetaTags.getProperty("robots");

3:增加这个值到metadata中:

parse.getData().getMetadata().put("robots", robots);

4: robots属性还可以再次从 metadata获取:

String robots2 = parse.getData().get("robots");





http://www.niftyadmin.cn/n/3649749.html

相关文章

链表中倒数最后k个结点

描述 输入一个长度为 n 的链表,设链表中的元素的值为 ai ,返回该链表中倒数第k个节点。 如果该链表长度小于k,请返回一个长度为 0 的链表。 数据范围:0 \leq n \leq 10^50≤n≤105,0 \leq a_i \leq 10^90≤ai​≤109…

flutter获取地理位置_Flutter:使用Geolocator插件获取用户位置

flutter获取地理位置Ever wanted to get a user’s location within your Flutter application? We’re going to be building an application that does exactly that by taking advantage of the Geolocator plugin. 是否曾经想在Flutter应用程序中获取用户的位置&#xff1…

用户界面和多媒体版面问题[二][j2medev][0406更新]

第一部分在 "用户界面和多媒体"版面问题整理[j2medev.com][不断更新中]。下面是后续更新的部分。全部目录为:1 全屏问题2 Image和ByteArray转换问题3 getRGB问题4 字符串换行问题5 字体问题6 重新播放音乐问题7 MediaException问题8 混音问题9 CustomItem…

手机用户界面和多媒体版面有价值问题整理[j2medev.com][0406更新]

预告:j2medev.com将开始整理各个版面的有价值问题,并以PDF格式集结,敬请期待。出品商产品名称产品版本J2medev.com版面有价值的问题合集0.1j2medev.com之“用户界面和多媒体”版面有价值问题的整理历史VersionDateCreatorDescription1.0.0.12…

golang init_了解Go中的init

golang init介绍 (Introduction) In Go, the predefined init() function sets off a piece of code to run before any other part of your package. This code will execute as soon as the package is imported, and can be used when you need your application to initial…

MIDP设计模式之集结贴[JavaME]

1:架构性宣言: MIDP 2.0 中的工厂设计模式如何使用 MIDP 的 Generic Connection Frameworkhttp://www-128.ibm.com/developerworks/cn/java/wi-arch22/ 级别: 初级Mikko Kontio, 产品经理, Softera2006 年 3 月 13 日这个月将学习有关 MIDP 2.0 的更多知识,同 Mikko…

计网笔记--网络层

1--网络层概述 网络层主要问题: ① 网络层向运输层提供怎样的服务? (可靠或不可靠) ② 网络层寻址问题(IP 地址) ③ 路由选择问题 (路径) 重点在于:TCP/IP协议栈 2--网络…

Flutter:如何使用WebView插件

Displaying webpages inside of your Flutter applications is easy with the use of the WebView plugin. In our example application, we’ll look at how to create a custom Widget that can be used throughout our application to launch a WebView from anywhere. 显示…