Scrape web content using Selenium and BeautifulSoup and export grouped data to CSV.
Project description
scrapecsv
scrapecsv is a lightweight Python tool that uses Selenium and BeautifulSoup to scrape data from multiple web pages and export results to CSV. Supports JavaScript-rendered sites and basic proxy configurations to reduce the risk of IP blocking.
Features
- Works with JavaScript-rendered pages
- Works with un-authenticated proxies to avoid IP blocking
- Groups scraped tags by URL with option of writing data into a csv file
- Optional structured Python data return
Proxy Support
proxy = [http://ip:port]
proxy = [http://127.0.0.1:8000]
Ensure the proxy type (http vs https) matches the protocol of the website you are scraping.
Installation
pip install scrapecsv
Usage
from scrapecsv import scrape_to_csv
url = ["https://quotes.toscrape.com/"]
tag = ["div.quote span.text", "div.quote span small"]
proxy = ["http://127.0.0.1:8000"] # Optional
scrape_to_csv(
urls=url,
tags=tag,
write_to_csv=True,
output_file="quotes.csv",
return_structured_data=False,
headless=True,
proxies=proxy # Add this parameter if using proxies
)
Note
Support for authenticated proxies coming soon
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapecsv-1.1.0.tar.gz.
File metadata
- Download URL: scrapecsv-1.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
372b8f181129b47841c1e9391df0e04cda4ca05fa7d3abf0928e28964f3dde03
|
|
| MD5 |
1da01e84562eec48d8c8b6854a9d2f9b
|
|
| BLAKE2b-256 |
e598d55dce5f653e7c0cd89467f71b24f139d449600f15a6e4496a86d2ba0b77
|
File details
Details for the file scrapecsv-1.1.0-py3-none-any.whl.
File metadata
- Download URL: scrapecsv-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddfa2154fc1d690b3b770d2cb6015087c8942c17ccef2814cc9aeff7cdda1097
|
|
| MD5 |
ad43844e0d88471695df2fc504e4c7b2
|
|
| BLAKE2b-256 |
918132d32304733ed79fd33541dc97308effb3d8cb66ede93a00b71ab41fb083
|