GithubHelp home page GithubHelp logo

another-scraper-php's Introduction

GitHub license

This is service which allow us to interact with a scraper and a crawler using HTTP. The basic idea is to be able to convert every source in the internet into a consumable JSON.

Table of Contents

  1. Installation
  2. Features
  3. Usage

Installation

You need a SQL server running, edit src/Server/Database.php to add your configuration.

With Composer:

git clone https://github.com/Muramasah/another-scraper-php.git

cd another-scraper-php

composer install

Features

Crawler

The crawler has not real crawling features yet, but encapsulates the logic which handles the http request and the source model creation. There is no access to the crawler configuration though the API yet.

Engines

Actualy we only have a DOM engine, which works using css selectors to pick data from an html.

Extractors

The extractor tells to the engine how we will extract something, and what name we want for this data. So, a extractor is a configuration string to extract or scrap a named data.

Usage

After the installation we need to run a php server like

php -S localhost:8000

which wil be able to respond to:

POST

/scrap

source

Url to the source which will be scraped.

engine

These are the processors which allow us to configurate how the data will be extracted. Actually there is only one, the DOM engine.

extractors

JSON with the configuration to scrap individualized data with titles/keys.

Example

Body from a post request to http://localhost:8000/scrap

{
  "source": "https://www.imdb.com/title/tt1560220",
  "extractors": {
    "title":".originalTitle::text",
    "description":".summary_text"
    }
}

Expected response:

{
    "title": "Zombieland: Double Tap",
    "description": "Columbus, Tallahassee, Wichita, and Little Rock move to the American heartland as they face off against evolved zombies, fellow survivors, and the growing pains of the snarky makeshift family."
}

another-scraper-php's People

Contributors

xfelipem avatar

Watchers

 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.