태그 : crawler

Javascript Link처리가 가능한 Web Cralwer

우리나라(특히 관공서)의 홈페이지를 자세히 들여다 보면 특이한(?) 방식으로 HyperLink를 구성하는 걸 볼 수가 있다.

보통의 링크는
<A href="http://esconsult.egloos.com/" target="_blank">Enterprise Search Consulting</A>
<A href="../index.html">메인</A>
처럼 사용되는데 비해 Javascript가 사용되는 링크는
<A href="javascript:gomain();">메인페이지</A>
<A href="#" onclick="gomain()">메인페이지</A>
<TD onclick="gomail(1)">메인페이지로 이동</TD>
처럼 사용된다.

이는 Web Cralwer를 만드는 사람 입장에서 보면 굉장한 벽이 아닐 수 없다.
왜냐하면 Javascript링크를 제대로 처리하려면 Javascript interpreter와 HTML DOM를 구현해야하지만, 이를 제대로 구현하기가 절대 쉽지 않기 때문에 이 둘을 구현하는 것만으로도 Web Cralwer를 구현하는 이상의 노력이 필요하기 때문이다.
따라서 일반적으로 포털의 Web Cralwer는 Javascript형태의 링크를 처리하지 못하는 것이 대부분이다.

Microsoft Internet explorer를 후킹하여 비교적 쉽게 이를 해결할 수 있으나, 빠른 속도를 필요로 하는 수집에서는 손해를 볼 수 밖에 없다.

그래서!!! IE를 사용하지 않고 Javascript를 처리하는 모듈을 만들어 봤다.

참조 : javascript link처리가 가능한 web page 분석 모듈

전체적으로 java를 이용하였으며, 웹페이지를 가져와서 link와 text를 분리하는 것만 만들었다.
안정화 및 속도 검증은 하지 않았지만, IE를 이용하는 방식보다는 (훨씬) 빠를 것으로 기대한다.
하지만, 역시 javascript interpreter와 HTML DOM은 많이 무거운게 사실이다.
또한, 자바스크립트를 제대로 처리하려면 HTML 랜더링까지 해야하니 속도/부하면에서 다른 로봇과 차이가 날 수 밖에 없다.

한번씩 테스트 해 보시고, 가능성(?) 여부를 판단해 주시면 감사 ^^

by 슈퍼맨 | 2009/02/03 21:07 | 기술 | 트랙백 | 덧글(4)

[open source]Smart and Simple Web Crawler


링크: https://crawler.dev.java.net/

아파치 라이센스이며 루씬과 마찬가지로 라이브러리 형태이다.

간단설명
---------------
  • Smart and easy framework thats crawls a web site
  • Integrated Lucene support
  • It's simple to integrate the framework in own applications
  • The crawler can start from one or from a list of links
  • Two crawling models available:
    • Max Iterations: Crawls a web site through a limited number of links: Fast model with a small memory footprint and cpu usage.
    • Max Depth: A simple graph model parser without recording in and outcoming links. Fast as the max interations model.
  • Accept filter interface to limit the links to be crawled
  • Core accept filters available: ServerFilter, BeginningPathFilter and RegularExpressionFilter
  • Combining the accept filters with AND, OR and NOT possible
  • Plugable http connection libraries HttpClient (default) and HTMLParser (optional)
  • Own listeners can be added in the parsing process
  • The framework is not a GUI based tool to mirror a website and browse the site offline!

느낌
---------
    - 간단하게 웹로봇을 만들려고 할때 유용한 라이브러리가 될 것 같다.
   - 대용량 로봇은 힘들 듯....
    - 역시나 우리나라에서 많이 사용되는 javascript형태의 링크는 지원을 하지 않는 것 같고 향후 readmap에도 없다.
    - 중복페이지(혹은 중복서버) 검출방법이 살짝 궁금하다는....
      (단순히 url만으로 처리하는지? 아니면 네임서버 분석까지 하는지... 등등...)

by 슈퍼맨 | 2008/07/30 10:10 | 기술 | 트랙백 | 덧글(0)

◀ 이전 페이지다음 페이지 ▶