Skip to main content

PyMailScraper

PyMailScraper is a powerful and easy-to-use Python tool for scraping email addresses from websites. It can crawl multiple pages, respect throttling limits, and save results in a convenient CSV format.

Installation

You can install PyMailScraper using pip:

pip install pymailscraper

Usage

PyMailScraper can be used both as a command-line tool and as a Python library.

Command-line Usage

After installation, you can use PyMailScraper from the command line:

pymailscraper [OPTIONS]

Options:

  • -u, --urls: One or more URLs to scrape. You can provide multiple URLs separated by spaces. Example: pymailscraper -u https://example.com https://another-example.com

  • -f, --file: Path to a file containing URLs (one per line). Example: pymailscraper -f urls.txt

  • -o, --output: Output CSV file path (default: "email_results.csv"). Example: pymailscraper -u https://example.com -o my_results.csv

  • -d, --depth: Maximum depth to crawl (default: 3). Example: pymailscraper -u https://example.com -d 5

  • -p, --pages: Maximum number of pages to crawl per website (default: 100). Example: pymailscraper -u https://example.com -p 50

  • --common-pages-only: Crawl only common pages (default: False). Example: pymailscraper -u https://example.com --common-pages-only

  • --use-common-pages: Use common pages in crawling (default: False). Example: pymailscraper -u https://example.com --use-common-pages

  • --throttle: Delay between requests in seconds (default: 0). Example: pymailscraper -u https://example.com --throttle 1.5

  • --auto-throttle: Automatically adjust throttle on 'Too many requests' responses. Example: pymailscraper -u https://example.com --auto-throttle

  • --max-throttle: Maximum throttle delay in seconds (default: 5). Example: pymailscraper -u https://example.com --auto-throttle --max-throttle 10

Python Library Usage

You can also use PyMailScraper in your Python scripts:

from pymailscraper import EmailScraper

scraper = EmailScraper(
    output_file="results.csv",
    max_depth=3,
    max_pages=100,
    throttle=1.0,
    auto_throttle=True
)

urls = ["https://example.com", "https://another-example.com"]
scraper.run(urls)

Examples

  1. Scrape a single website:
pymailscraper -u https://example.com
  1. Scrape multiple websites:
pymailscraper -u https://example.com https://another-example.com
  1. Scrape websites from a file with custom output and depth:
pymailscraper -f urls.txt -o results.csv -d 5
  1. Use auto-throttling with a maximum of 50 pages per site:
pymailscraper -u https://example.com --auto-throttle -p 50

Output

PyMailScraper saves the results in a CSV file with the following columns:

  • URL: The page where the email was found
  • Email: The email address
  • Name: Any associated name found (if available)

Ethical Usage

Please use this tool responsibly. Always respect the website's terms of service, robots.txt files, and any legal restrictions on scraping. Be mindful of the load you're putting on websites and use throttling when appropriate.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository.

Happy scraping!

Metadata

Release files for pymailscraper 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymailscraper 0.1.0
File Size Uploaded Provenance Actions
pymailscraper-0.1.0.tar.gz 7.0 kB Without provenance Details for pymailscraper-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.5 kB

Release files / pymailscraper-0.1.0.tar.gz

Download URL pymailscraper-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a162d7d65f7a096546f813b3c6b372f27eca06aa2291fd2ec29ef5821e26981d
BLAKE2b-256 checksum
How to use checksums
dc0d36a89b4635d1dc3aeca17a0db8b0b576eed793a74b9e964ae2108a765dfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / pymailscraper-0.1.0-py3-none-any.whl

Download URL pymailscraper-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72f0160ea820b718d46f0cf551a024d2c0be50e26c957718423e68082d97934f
BLAKE2b-256 checksum
How to use checksums
1a93962a09e03a8ba0adda9380840c7740a0750e8a8e61157398f64c627b47e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for pymailscraper 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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