Scrape websites with a given schema.
Project description
Jaydee
Crawl websites and scrape HTML documents using a .json file schema.
Installation
$ pip install jaydee
Usage
More in-depth usage examples can be found in the directory examples.
Crawling:
import asyncio
from src.jaydee.crawler import Crawler
async def main():
# on_proceed is called once the crawlers url queue is empty.
# defining it is optional.
def on_proceed(crawler):
# Add pages after crawler has extracted links.
crawler.add_url("https://www.example.com/foo")
crawler = Crawler(
"https://www.example.com",
on_proceed,
)
async for link in crawler.start():
print(link)
def start():
asyncio.run(main())
Scraping:
import requests
from jaydee import Scraper
# Retrieve an HTML document.
r = requests.get("https://example.com")
# Setup the scraper with rules according to a .json file.
scraper = Scraper(html_doc=r.content).from_json("data/rules.json")
# Get a result
result = scraper.scrape()
License
This repository is licensed under the MIT license.
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
jaydee-0.1.0.tar.gz
(7.0 kB
view details)
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 jaydee-0.1.0.tar.gz.
File metadata
- Download URL: jaydee-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32caa9fec4989ffa827a41a3fad73a5fbf8e74a7bd32270eebeb6c3b2aeebf38
|
|
| MD5 |
4f92bd57479f161dd89a842bad124afb
|
|
| BLAKE2b-256 |
f57b7ef5efed69aabb6c4fbd2406b3c5bb8ae4a2fcaf3a1a6e3b28f0c8a6c7d4
|
File details
Details for the file jaydee-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jaydee-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c411603cc66a510cdf56aab2a7c5ffb8359cbadc342a868964793f20ac78206e
|
|
| MD5 |
c9c23b89b46b3c29259cc1b3d9e5a9ae
|
|
| BLAKE2b-256 |
fbaf39c73d7a4e2df80929ef4e9df75ff8ec673f3d46af52d60a762772d8940a
|