技术相关

离职前的PPT演示

2

这是离职前一天晚上给小朋友们演示的PPT(PS:我不想晚上的,但那天下午会议室已经被别人申请了。。。)
我居然讲了82分钟,我勒个神哪,到后面真是口干舌燥。。。原以为能讲30分钟就不错了的,汗 (更多…)

没准儿您会对以下内容感兴趣:

  • No Related Posts

一个网络爬虫的项目总结—链接抽取部分

0

在搞定了ActiveMQ的 性能/内存泄露 问题之后,我的重心转移到了网页链接提取这一块。
在详细说之前,需要说一下网络爬虫链接抽取的一个最基础原则:

为了避免对一个URL重复的访问,需要维护一个URL总库,对于不是超大型的应用而言,应该是一个独立的库。(没有接触过真实搜索引擎的实现,他们不大能是只有一个总库的)

这个库维护的是对于下载过或发现了的链接

那么,对于链接的抽取,主要就有以下任务:

  1. 从页面中抽取出链接【集合】
  2. 遍历链接集合,判断每一个链接是否在之前已经发现过了,或者下载过,近期不再会下载的。过滤掉一些链接
  3. 将剩下的链接存储入库

(更多…)

没准儿您会对以下内容感兴趣:

一个网络爬虫的项目总结—ActiveMQ部分

0

项目还没完全完工,但是关于爬虫相关的部分已经不会再有什么更改了。
还会进行大改的,是用Lucene存储链接的对应模块,设计方案已经通过讨论,只剩下实现。
那么就到写项目总结的时间了。

这个爬虫经历过一次完全构架的重新选择:从基于Nutch的体系改为了自己写很多东西
之前,我对Nutch+Hadoop做了二次开发并把系统搭建好,但是Fetcher部分的性能不好搞。
Nutch的任务都是基于Hadoop的,然后Input和Output都严重依赖于HadoopIO。我在把主体代码写完后,有试着虚构一个假的RecordReader给Fetcher以启动它。但是只写了一个Demo就没往下写了。只凭第一感觉的话,大概是可以的。但是因为对Hadoop的不熟悉,而且时间也不足够,也就没往下再深究了。此时领导也已经决定抛弃Nutch,转用自己实现多数东西。 (更多…)

没准儿您会对以下内容感兴趣:

Nutch – Fetcher

0

Fetcher

From command line, using this to start Fetcher:

hostname:${NUTCH_HOME}$ bin/nutch Fetcher <segment> [-threads n] [-noParsing]

if noParsing is set, Fetcher just fetch urls and don’t parse text/links.

org.apache.nutch.fetcher.Fetcher implements org.apache.hadoop.mapred.MapRunnable, so its mapred method is: run(RecordReader, OutputCollecotr, Reporter). And there’s no method named neither map(xxx) nor reduce(xxx). (更多…)

没准儿您会对以下内容感兴趣:

Nutch – Generator

1

Nutch – Generator

From command line, using this to call Injector (simplest):

hostname:${NUTCH_HOME}$ bin/nutch Generator <crawldb> <segments_dir>

Generator select some urls from crawldb, generate a segment. After this, Fetcher starts to do fetch task. (我想说Fetcher以一个segment为单位开始做fetch任务,但是这样用英文不知道怎么说。。。)

Generator has 3 MapReduce jobs.

  • Select job
  • Partition job
  • Update job(option,选择性的)

(更多…)

没准儿您会对以下内容感兴趣:

HtmlCleaner, XPath

0

HtmlCleaner supports XPath to find tagNode/attribute, but it is not fully supported XPath parser and evaluator.
See Object[] org.htmlcleaner.TagNode.evaluateXPath(String xPathExpression) throws XPatherException:

public Object[] evaluateXPath(String xPathExpression) throws XPatherException
Evaluates XPath expression on give node.
This is not fully supported XPath parser and evaluator. Examples below show supported elements:

  • //div//a
  • //div//a[@id][@class]
  • /body/*[1]/@type
  • //div[3]//a[@id][@href='r/n4']
  • //div[last() >= 4]//./div[position() = last()])[position() > 22]//li[2]//a
  • //div[2]/@*[2]
  • data(//div//a[@id][@class])
  • //p/last()
  • //body//div[3][@class]//span[12.2
  • data(//a['v' < @id])

(更多…)

没准儿您会对以下内容感兴趣:

  • No Related Posts
Go to Top