Skip to main content

PyWebScrapr

Python Version Code Size Downloads License Compliance PyPI Version

An open-source Python library for web scraping tasks. Includes support for both text and image scraping.

Changes in 0.1.7:

  • Optimized is_similar_regex text similarity and duplicate checking by caching text normalization and word splitting, drastically improving duplicate text detection speed by up to 25x (~96% CPU time reduction).

Changes in 0.1.6:

  • Added progress indicators to both scrape_images and scrape_text to provide real-time feedback on scraping progress.
  • Implemented multithreading to improve performance by scraping multiple pages concurrently.
  • Added a rate_limit parameter to both scraping functions to control the request frequency and prevent server overload.
  • Refactored the concurrency model to ensure that child links are also scraped concurrently.

Changes in 0.1.5:

  • Added new params to both scrape_images and scrape_text to allow for following child links, and setting a maximum allowed followed child links.
  • Added a json export format for text scraping, with improvements to exporting.

Changes in 0.1.4:

  • Added new parameters to scrape_text to allow automatic removal of duplicates or similar text, and another to specify the type of textual content to scrape (text, content, unseen, links).

Changes in 0.1.3:

  • Added support for handling of different types of images on websites. Also now checks for invalid images, with added error handling.

Changes in 0.1.2

Changes in version 0.1.2:

  • min and max width and height parameters can now be specified when working with image scraping, allowing you to quickly exclude smaller resolution images, or images that are extremely large and take up too much space.
  • PyWebScrapr now uses BeautifulSoup4's SoupStrainer, making extracting content from webpages much faster.

Installation

You can install PyWebScrapr using pip:

pip install pywebscrapr

Supported Python Versions

PyWebScrapr supports the following Python versions:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10
  • Python 3.11
  • Python 3.12/Later (Preferred)

Please ensure that you have one of these Python versions installed before using PyWebScrapr. PyWebScrapr may not work as expected on lower versions of Python than the supported.

Features

  • Text Scraping: Extract textual content from specified URLs.
  • Image Scraping: Download images from specified URLs.

*for a full list check out the PyWebScrapr official documentation.

Usage

Text Scraping

from pywebscrapr import scrape_text

# Specify links in a file or list
links_file = 'links.txt'
links_array = ['https://example.com/page1', 'https://example.com/page2']

# Scrape text and save to the 'output.txt' file
scrape_text(links_file=links_file, links_array=links_array, output_file='output.txt')

Image Scraping

from pywebscrapr import scrape_images

# Specify links in a file or list
links_file = 'image_links.txt'
links_array = ['https://example.com/image1.jpg', 'https://example.com/image2.png']

# Scrape images and save to the 'images' folder
scrape_images(links_file=links_file, links_array=links_array, save_folder='images')

Contributing

Contributions are welcome! If you encounter any issues, have suggestions, or want to contribute to PyWebScrapr, please open an issue or submit a pull request on GitHub.

License

PyWebScrapr is released under the terms of the MIT License (Modified). Please see the LICENSE file for the full text.

Modified License Clause

The modified license clause grants users the permission to make derivative works based on the PyWebScrapr software. However, it requires any substantial changes to the software to be clearly distinguished from the original work and distributed under a different name.

Metadata

Release files for pywebscrapr 0.1.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 pywebscrapr 0.1.7
File Size Uploaded
pywebscrapr-0.1.7.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 16.5 kB

Release files / pywebscrapr-0.1.7.tar.gz

Download URL pywebscrapr-0.1.7.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fbdc9111dd52500c3cdc88bd7898219fa757a1202854ad2b0d26d43da74af46c
BLAKE2b-256 checksum
How to use checksums
8685a138df12b42c2901c58b2b9951e88f5a049954d055a600a669d3820d8606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pywebscrapr-0.1.7-py3-none-any.whl

Download URL pywebscrapr-0.1.7-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea2bb3de74dd85a8f0b81d8a3b105ac631db92bb1dee07970ca8d11ac71b99a4
BLAKE2b-256 checksum
How to use checksums
c523ebddf0da4ac1cf69b0793e72d890170d4bb95af74154d251ed4f451fd1bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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