Skip to main content

An Easy Scraper for HTML

Project description

easy-scraper-py

PyPI

An easy scraping tool for HTML

Goal

Re-implementation of tanakh/easy-scraper in Python.

Install from PyPI

   pip install easy-scraper-py

Usage Example

<!-- Target -->
<body>
    <b>NotMe</b>
    <a class=here>Here</a>
    <a class=nothere>NotHere</a>
</body>

<!-- Pattern -->
<a class=here>{{ text }}</a>
import easy_scraper

target = r"""<body>
    <b>NotMe</b>
    <a class=here>Here</a>
    <a class=nothere>NotHere</a>
</body>
"""  # newlines and spaces are all ignored.

pattern = "<a class=here>{{ text }}</a>"

easy_scraper.match(target, pattern)  # [{'text': 'Here'}]
# XML (RSS) scraping
import easy_scraper
import urllib.request

body = urllib.request.urlopen("https://kuragebunch.com/rss/series/10834108156628842505").read().decode()
res = easy_scraper.match(body, "<item><title>{{ title }}</title><link>{{ link }}</link></item>")
for item in res[:5]:
    print(item)

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

easy-scraper-py-0.1.5.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

easy_scraper_py-0.1.5-py3-none-any.whl (4.7 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