Skip to main content

Declarative web parsers

Project description

Soup Stars

Build Status

Version Python

Soup Stars is a framework for building web parsers with Python. It is designed to make building, deploying, and scheduling web parsers easier by simplifying what you need to get started.

Quickstart

pip install soupstars

Creating a parser

New parsers are created by typing soupstars create into a terminal, and supplying the name of a python module.

soupstars create myparser.py

Soup Stars will use a template parser to help you get started. This example creates a parser that extracts headlines from articles on the New York Times website.

from soupstars import data, follow

url = "https://www.nytimes.com"

@follow
def follow(url):
    return (url.domain == "www.nytimes.com") and (url.match("\d{4}\/\d{2}\/\d{2}"))

@parse
def h1(soup):
    return soup.h1.text

You can test that the parser functions correctly.

soupstars run myparser

Use soupstars --help to see a full list of available commands.

More documentation is available here.

Development

Start the docker services.

docker-compose up -d

Set up the containers.

docker-compose exec web flask s3 mb soupstars-archive
docker-compose exec web flask db upgrade
docker-compose exec web flask seed schedules
docker-compose exec web flask seed plans
docker-compose exec web flask seed user
docker-compose exec web flask seed parsers

Run the tests.

docker-compose run --rm client pytest -vs

Releasing

New tags that pass on CI will automatically be pushed to docker hub.

To deploy to PyPI requires manually running the following commands.

pip3 install twine
python3 setup.py sdist bdist_wheel
twine upload dist/*

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

soupstars-2.11.23.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soupstars-2.11.23-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file soupstars-2.11.23.tar.gz.

File metadata

  • Download URL: soupstars-2.11.23.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for soupstars-2.11.23.tar.gz
Algorithm Hash digest
SHA256 9616a64905b77d1f147e63553a036a96c5dfb694d4a6a4e0a0d972410e7dce21
MD5 494eefb87162fe3343a82462436a7d14
BLAKE2b-256 472306066e1ab5af30c3663ab1ab15a35ebf27a2bc1c1ecfd537def3a12f20ce

See more details on using hashes here.

File details

Details for the file soupstars-2.11.23-py3-none-any.whl.

File metadata

  • Download URL: soupstars-2.11.23-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for soupstars-2.11.23-py3-none-any.whl
Algorithm Hash digest
SHA256 03d693ff6a0c8d62b1f94d8b9e09fa86122e1c8229fd69f9670a3fb7fa9743eb
MD5 1a2eb68125be41ab292ab6341eb079da
BLAKE2b-256 17a2f9413bf40b63e646fd67422fddb2879c98fd9ee66298541982d276cc0c6d

See more details on using hashes here.

Supported by

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