A Python package for web scraping and parsing using Selenium, BeautifulSoup, and Llama LLM.
Project description
Rufus Scraper
rufus-web-scraper is a Python package for web scraping and content parsing. It combines the power of Selenium, BeautifulSoup, and LangChain Ollama to extract and process data from web pages efficiently.
Features
- Scrape Websites: Fetch content from webpages, including nested links.
- Clean HTML Content: Extract meaningful text by removing scripts, styles, and unnecessary elements.
- Parse with AI: Use AI models like Ollama locally to parse scraped content based on custom prompts.
- Customizable Depth: Scrape nested links up to a specified depth. (currently max_depth=1)
Installation
Install Rufus Web Scraper with pip:
pip install rufus-web-scraper
Setting Up Before Use
Selenium Crawler API Key
To enable the Selenium crawler, you need to create a Remote API key for crawling websites:
- Visit https://brightdata.com/.
- Sign up for a free account.
- Navigate to Proxies and Scraping > Click Add > Select Scraping Browser.
- Generate a web-crawling API key and save it.
- Pass the API key directly in the ".scrape" function.
Download the Llama Model Locally
To use the Llama model for parsing:
- Visit https://ollama.com/download.
- Download the Ollama setup for your platform and install it.
- Open Command Prompt (Windows) or Terminal (Mac/Linux).
- Run the following command to ensure Ollama is installed:
ollama
- Download the Llama3.1 model locally:
ollama pull llama3.1
Example Usage
import rufus-web-scraper
from rufus-web-scraper import RufusClient
client = RufusClient()
documents = client.scrape(url,scraper_key,prompt)
print(document)
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
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 rufus_web_scraper-1.0.2.tar.gz.
File metadata
- Download URL: rufus_web_scraper-1.0.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
436bb7e3fee8c2f16076dc82f2d09a97ff87fb44771ac1255538bfa56e593406
|
|
| MD5 |
f44eec2a616513e4bdb6e299fa5d54fa
|
|
| BLAKE2b-256 |
b1292fb06f897dd8304cacce40739975b384adb854f3dbc74dc3037053eabf7d
|
File details
Details for the file rufus_web_scraper-1.0.2-py3-none-any.whl.
File metadata
- Download URL: rufus_web_scraper-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ee12bb2644e4eaf738751f16ffd814e180b8f3a3281642897ab3bb3d24e3b04
|
|
| MD5 |
77bb984846fb7e1c2ed94a4657fdd089
|
|
| BLAKE2b-256 |
1ecd9baff2fae256c7cfa1ed692814432587102c6ab0efd1b8f1586ce730f4d7
|