Code Monkey home page Code Monkey logo

creepycrawler's Introduction

Creepy Crawler

Creepy Crawler is a service made with Spark Framework (https://sparkjava.com) that run web crawlers in search of specific keywords.

Before run -> Configuration

Creepy Crawler is configured via these environment variables:

BASE_URL [required] Defines the first page to be visited by each web crawler;
Defines the scope of the analysis, where only adresses nested to this one can be accessed by the crawlers;
MAX_RESULTS [optional] Defines the maximum number of page addresses that can be accumulated in an analysis. When reached, the crawler must stop immediately

Attention: BASE_URL must be setted or the server will not start.

Running

If you want to run locally, you need maven installed: https://maven.apache.org

Just run the command: mvn clean verify exec:java

or you can run over Docker: docker build . -t artiumdominus/creepycrawler docker run -e BASE_URL=https://github.com -p 4567:4567 --rm artiumdominus/creepycrawler

API

As suggested in the docker command above, Spark init the server in the port 4567 by default.

POST /crawls

Inits a new search analysis, seeking for the informed keyword (the keyword must have between 4 and 32 characters). Then returns an 8-character unique id.

req
{ "keyword": "cybernetics" }
res
200 OK
{ "id": "#######" }
400 BAD REQUEST
{ "status": 400, "message": "field 'keyword' is required (from 4 up to 32 chars)" }

GET /crawls/:id

Fetch the analysis data of a given search. The status can be either "active" or "done"

res
200 OK
{
  "id": "########",
  "status": "active",
  "urls": [
    "https://github.com/",
    "https://github.com/artiumdominus",
    "https://github.com/artiumdominus/CreepyCrawler"
  ]
}
404 NOT FOUND
{ "status": 404, "message": "crawl not found: ########" }

GET /crawls

Get the analysis ids list.

res
200 OK
["########"]

DELETE /crawls/:id

Deletes a given search analysis, it's only possible to delete the searchs that already stopped.

200 OK
"ok"
400 BAD REQUEST
{ "status": 400, "message": "crawl ######## is still active." }
404 NOT FOUND
{ "status": 404, "message": "crawl not found: ########" }

creepycrawler's People

Contributors

artiumdominus avatar

Stargazers

Murilo Seno 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.