2017 © Pedro Peláez
 

library charlotte

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

image

randak/charlotte

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  • Monday, March 24, 2014
  • by randak
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 5 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Charlotte

Author: Kristian Randall kristian.l.randall@gmail.com Copyright 2014, (*1)

PHP-based web crawler for site analysis. Crawls your website and stores information about your pages, scripts and stylesheets in a Neo4j graph database. (Can be extended to use any database.), (*2)

Installation

Install using Composer:, (*3)

composer require randak/charlotte:dev-master, (*4)

Depending on your composer settings, you may need to run composer require everyman/neo4jphp:dev-master before you can install Charlotte. If you get an error about that package not being available, this is the likely solution., (*5)

In addition to installing Charlotte, you'll also need Neo4j, whether it be on the same machine or another server., (*6)

Configuration

After installation, you will need to set up your configuration. Currently, there is an example config file in the examples folder. The config will look something like this:, (*7)

    crawler:
        start: http://www.example.com
        exclude:
            - "/^javascript\:void\(0\)$/"
            - "/^#.*/"
            - "/^\\/$/"
            - "/\.(pdf|zip|zi|png|jpg|jpeg|doc|ppt)$/i"
    connections:
        Neo4j:
            host: localhost
            port: 7474

You should set the URL here to be the homepage of the website you wish to crawl., (*8)

The exclude patterns are regular expressions that will match URLs you don't want to crawl. For example, we are ignoring certain file types, and any URL that starts with a #., (*9)

Usage

Charlotte is currently designed to be run from the command line only., (*10)

Create a file called crawl.php., (*11)

touch crawl.php, (*12)

Insert the follow., (*13)

    <?php

    require('path/to/vendor/autoload.php'); //set this

    use Everyman\Neo4j\Client;
    use Charlotte\Charlotte;
    use Charlotte\Processor\Neo4jProcessor;
    use Symfony\Component\Yaml\Parser;

    $yaml = new Parser();
    $config = $yaml->parse(file_get_contents(__DIR__."/config.yml")); //set this

    $conn = $config["connections"]["Neo4j"];

    $client = new Client($conn["host"], $conn["port"]);

    $charlotte = new Charlotte();

    $charlotte->setConfig($config);
    $charlotte->setProcessor(new Neo4jProcessor($client));

    $charlotte->traverse();

Make sure everything is set up in your config.yml and that your database is open., (*14)

Run the script., (*15)

php crawl.php, (*16)

Contributions

Contributions are welcome! If you'd like to contribute, please create an issue first., (*17)

Disclaimer

This crawler is intended to be used only on websites which are owned or operated by you. The developer(s) of this tool are not responsible for any use of this code that violates any laws or otherwise causes harm, and are not liable for any misuse., (*18)

The Versions

24/03 2014

dev-master

9999999-dev

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

24/03 2014

1.2.1

1.2.1.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

23/03 2014

1.2

1.2.0.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

23/03 2014

1.1.2

1.1.2.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

22/03 2014

1.1.1

1.1.1.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

22/03 2014

1.1

1.1.0.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

21/03 2014

1.0.2

1.0.2.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall

21/03 2014

1.0.1

1.0.1.0

Charlotte crawls through your website and captures data in a database, including links between pages, H1 elements, scripts, stylesheets, and keywords.

  Sources   Download

GPL-3.0

The Requires

 

by Kristian Randall