Giter Club home page Giter Club logo

reflect3746's Introduction

Modular Scraper System

Robust crawler framework for getting legal document from websites

Python Version NPM Version Flask Version Scrapy Version Vue Version Mongo Version

Backend: With Scrapy module running on Twisted Reactor. Wrapping with Flask.

Frontend: Vue

Database: MongoDB Atlas

header-pic

Requirements

Installation & Setup

LINUX:

> mkdir '<create-a-folder>'

> cd '<create-a-folder>'

> sudo git clone https://github.com/PandorAstrum/reflect3746.git

> cd backend

> sudo pip install -r requirements.txt

> cd ..

> cd frontend

> sudo npm install

N.B: In backend/db.py file change CONNECTION_STRING to your own mongodb database

RUN

  1. From backend directory start the server with:

    sudo python run_server.py
    
  2. From frontend directory start the dashboard with:

    sudo npm run serve
    

    Navigate to localhost:5000 on your browser to use the Dashboard

For api endpoint see below

Folder Structure

project root

├── backend
|   ├── App
|   |   ├── __init__.py
|   |   ├── db.py                           # contains mongodb settings
|   |   └── routes.py                       # API routes
|   ├── scraper
|   |   └── scraper
|   |       ├── spiders                     # contains spiders
|   |       ├── items.py
|   |       ├── middleswares.py
|   |       ├── pipelines.py
|   |       └── settings.py                 # scrapy settings
|   ├── static
|   ├── template
|   ├── config.py                           # flask config
|   └── run_server.py                       # ENTRY POINT FOR FLASK
|
└── frontend
    ├── public
    └── src

API Endpoints

http://127.0.0.1:5000/api/v1 endpoints after this


Server Status : GET

/server_status

returns: json (boolean if flask is running or not)


Database Status : GET

/database_status

returns: json (try connecting to mongo db)


List available spiders : GET , POST

/spider

returns: json (all spiders created by scrapy cli, e.g scrapy genspiders command)


Run Spider : POST

/run

returns: json (start selected spiders with param provided) requires: params as body payload

e.g:

{"spider_kwargs":{"baseurl":"https://www.example.com/","spider_name":"Example"},"spider_settings":{"sitemap":false,"delay":1}}


Get Results by ID : GET

/results/<_id_here>

returns: json (from mongodb scraped collection matching documents with id number)


Get All Results : GET

/all

returns: json (from mongodb scraped collections all documents)


Get All Logs : GET

/logs

returns: json (from mongodb logs collection all documents)


Ashiquzzaman Khan – @dreadlordn

https://github.com/PandorAstrum/reflect3746.git

Contributing

  1. Fork it (https://github.com/PandorAstrum/reflect3746.git/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

reflect3746's People

Contributors

ash1khan avatar

Watchers

 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.