Skip to content

lmmx/campbells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 recipe 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).

About

A condensed web scraping library 🥫

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages