Skip to main content

A condensed web scraping library.

Project description

Campbells 🥫

A condensed web scraping library.

InstallExamples

Adapted from beautifulsoup4's inner package, then linted, refactored, reduced, and seasoned to taste.

Development

To run pre-commit checks and tests:

pre-commit run --all-files && pdm run python -m pytest

Examples

To parse a string as HTML, your reciple should call for CampbellsSoup:

from campbells import CampbellsSoup

html_str = "<html><body><p>Hello world!</p></body></html>"
soup = CampbellsSoup(html_str)

Installation

Campbells is available on PyPi:

pip install campbells

The dependencies needed to use html5lib and lxml parsers are not installed by default. They can be installed with:

  • pip install campbells[html5lib] to be able to use html5lib.
    • Pros: closest to how browsers parses web pages, very lenient, creates valid HTML5.
    • Cons: slowest parser.
  • pip install campbells[lxml] to be able to use lxml.
    • Pros: fastest parser.
    • Cons: heavier dependency (C extension).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

campbells-0.3.0.tar.gz (145.3 kB view hashes)

Uploaded Source

Built Distribution

campbells-0.3.0-py3-none-any.whl (173.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page