FlexiCrawl is a simple site and file crawler, storing discovered pages and relationships in PostgreSQL. It exposes an API that can be consumed by the front-end. It's operation supports pause/resume of processing info. This is work in progress.
The system is split into:
- Crawler engine
- Database layer
- API layer
- State management
- Data query layer
If you find this extension useful, you can support development via PayPal:
Thank you for helping keep this project maintained and improving!
written by: Mark Samios @enigma1
--
mkdir <FlexiCrawl> folder
cd <FlexiCrawl> folder
git clone https://github.com/enigma1/FlexiCrawl.git .
npm i
cp .env.template .envInstall the dependencies:
python -m pip install -r requirements.txt
To start the application:
uvicorn main:app --reload
The API layer exposes routes for:
- Starting a crawl
- Pausing and resuming a crawl
- Restarting a crawl
- Removing/resetting tables
- Fetching crawler data
The API layer is responsible for:
- Validating incoming requests
- Resolving the target domain
- Selecting the correct database table
- Converting API request models into database query inputs
- Converting database results into API response models
A crawl starts through the crawler start route.
The start process:
- Receives a domain
- Creates the required database tables
- Inserts the root URL
- Starts the crawler loop
- Updates crawler state
The crawler runs independently from the HTTP request so API routes remain responsive.
The pause operation:
- Updates crawler state to request a pause
- The crawler loop checks the state
- The current work completes safely
- The crawler signals that it is idle
- The API returns once the crawler is paused
Resume starts a new crawler execution after a pause.
The previous crawler task is not reused. A completed paused task has finished its execution, so a new task/thread is created for the next crawl cycle.
Restart performs:
- Pause the current crawler if running
- Wait until the crawler becomes idle
- Reset database tables
- Restore the root URL
- Reset crawler counters
- Start a new crawler execution
The database layer uses PostgreSQL.
Responsibilities:
- Creating crawler tables
- Removing/resetting schemas
- Inserting discovered URLs
- Storing page data
- Storing page relationships
- Executing generic table data queries
The data fetching layer provides generic table querying.
Supported features:
- Dynamic table selection
- Pagination
- Multiple column sorting
- Column metadata
- Row retrieval
The query layer receives:
{
"table": "...",
"paging": {
"offset": 0,
"limit": 50
},
"sort_by": [
{
"column": "title",
"direction": "ASC"
}
]
}GNU General Public License (GPL) v3