Skip to main content

Overview

GitHub

Main aim of this project is to provide simple tool for multiprocess crawling.
It can be used either as a tool for python project or as a command line tool.

Concept

This package was written to serve general purpose of crawling various resources.
To achieve that, Crawler interface needs to be adopted.
Just by implementing this interface, other Crawlers can be created and used with crawlMp manager.
Resource Crawler is then used with CrawlWorker.
Every crawler first enters entry point (link) and extract hits and links.
If specified, pipeline of actions is executed on every hit. By default, hits are collected in SIMPLE_MODE only and that's the fastest method to crawl as well.
If other metadata related to hit is required, use MODE_EXTENDED.
Other workers can pick up and follow link(s) from shared list asynchronously.

What is in the package

  • Crawler interface
  • Action interface
  • File system Crawler, Actions with search capabilities
  • scripts, providing easy access from command line

Installation

Pip

python3 -m pip install crawlMp

Git

git clone https://github.com/domarm-comat/crawlMp.git
cd crawlMp
python3 setup.py install

Usage examples

Scripts

  • Show help:
    search_fs_mp --help
  • Search for .zip files
    search_fs_mp \\.zip$
  • Get all .zip files in different directories
    search_fs_mp \\.zip$ -l /home /usr/share
  • Show search summary
    search_fs_mp \\.zip$ -l /home /usr/share -os

Python code (blocking)

from crawlMp.crawlMp import CrawlMp
from crawlMp.crawlers.crawler_fs import CrawlerSearchFs
from crawlMp.snippets.output import print_summary

manager = CrawlMp(CrawlerSearchFs, links=["/home"], num_proc=8, pattern="\.zip$")
manager.start()
print_summary(manager.results)

Python code (callback)

from crawlMp.crawlMp import CrawlMp
from crawlMp.crawlers.crawler_fs import CrawlerSearchFs
from crawlMp.snippets.output import print_summary


def on_done(manager):
  print_summary(manager.results)


manager = CrawlMp(CrawlerSearchFs, links=["/home"], num_proc=8, pattern="\.zip$")
manager.start(on_done)

Python code (actions)

from crawlMp.crawlMp import CrawlMp
from crawlMp.actions.action_fs import Copy, Remove
from crawlMp.crawlers.crawler_fs import CrawlerSearchFs
from crawlMp.snippets.output import print_summary


def on_done(manager):
  print_summary(manager.results)


# Copy all found zip files and then remove them
# It's just to demonstrate usage of actions
actions = (Copy(target_dir="/home/domarm/zip_files"), Remove())
manager = CrawlMp(CrawlerSearchFs, links=["/home"], num_proc=8, pattern="\.zip$", actions=actions)
manager.start(on_done)

Code coverage

Run pytests and code coverage by executing following commands

coverage run -m pytest --rootdir ./crawlMp/tests/
coverage report > coverage.txt

Metadata

Release files for crawlMp 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crawlMp 0.3.7
File Size Uploaded
crawlMp-0.3.7.tar.gz 45.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crawlMp 0.3.7
File Interpreter ABI Platform
crawlMp-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 95.2 kB

Release files / crawlMp-0.3.7.tar.gz

Download URL crawlMp-0.3.7.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7f6d3ee1a7bed35a9664432e65d398b67b4fda25750662378d1bb204358be93c
BLAKE2b-256 checksum
How to use checksums
c1e5789f9c4e6d0c54fa5e03c644c268a98964f64b27a6d12525e12f85f6f9f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / crawlMp-0.3.7-py3-none-any.whl

Download URL crawlMp-0.3.7-py3-none-any.whl
Size 50.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c3833e8dcdc1de6f73b0f030f7041bd8c306118d41f125aed785a593b631938
BLAKE2b-256 checksum
How to use checksums
9429e6b32c87d2f01cb1b075a819923706b9cedbb214d7f320e7105fca01fbee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page