Giter VIP home page Giter VIP logo

crawler's Introduction

Simple crawler

Simple crawler crawling Google

A simple web crawler that crawls only a single domain. Example graph shown above is the result of crawling Google's home page.

Dependencies

  • Maven
  • Java 1.8

Using it with your IDE

This code base is developed using IntelliJ with Lombok plugin installed. Annotation processing has to be activated to work well with the code base. This does not mean that other IDEs can't be used but it is preferred that your IDE can see the generated functions/classes.

Getting started

  • Run mvn package to obtain a runnable JAR
  • Run java -jar target/monzo-webcrawler-1.0-SNAPSHOT.jar http://somesite.com
  • Note that you should not include an ending forward slash at the end of the URL
  • An output file named output.html will be produced

Some extra options

usage: Monzo Webcrawler
    --external                    Adds external links to the output
    --help                        Print command line options
    --idle-time <idleTime>        The amount of time in whole seconds that
                                  a crawler would sit idle waiting for
                                  tasks
    --workers <numberOfWorkers>   The number of crawler workers to
                                  instantiate

Use java -jar target/monzo-webcrawler-1.0-SNAPSHOT.jar --help to see the different options

How it works

  1. A number of workers (crawlers) is created
  2. A queue is maintained for the crawlers to visit
  3. Workers act as both producers and consumers (taking and submitting to the queue)
  4. The workers will crawl and wait for a URL until there's no more URLs to crawl
  5. The workers will terminate itself once it waits for more than the idle time and there's no more URL to crawl

Credits

Author: William Heng

Special thanks to Mike Bostock and Joerg Baach for their examples on how to use d3.js to output the visually stunning graphs

crawler's People

Contributors

william8th avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.