Skip to main content

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:

  1. Visit https://brightdata.com/.
  2. Sign up for a free account.
  3. Navigate to Proxies and Scraping > Click Add > Select Scraping Browser.
  4. Generate a web-crawling API key and save it.
  5. Pass the API key directly in the ".scrape" function.

Download the Llama Model Locally

To use the Llama model for parsing:

  1. Visit https://ollama.com/download.
  2. Download the Ollama setup for your platform and install it.
  3. Open Command Prompt (Windows) or Terminal (Mac/Linux).
  4. Run the following command to ensure Ollama is installed:
ollama
  1. 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

rufus_web_scraper-1.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rufus_web_scraper-1.0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

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

Hashes for rufus_web_scraper-1.0.2.tar.gz
Algorithm Hash digest
SHA256 436bb7e3fee8c2f16076dc82f2d09a97ff87fb44771ac1255538bfa56e593406
MD5 f44eec2a616513e4bdb6e299fa5d54fa
BLAKE2b-256 b1292fb06f897dd8304cacce40739975b384adb854f3dbc74dc3037053eabf7d

See more details on using hashes here.

File details

Details for the file rufus_web_scraper-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for rufus_web_scraper-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ee12bb2644e4eaf738751f16ffd814e180b8f3a3281642897ab3bb3d24e3b04
MD5 77bb984846fb7e1c2ed94a4657fdd089
BLAKE2b-256 1ecd9baff2fae256c7cfa1ed692814432587102c6ab0efd1b8f1586ce730f4d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page