Universal content extraction library with tiered fetching strategies and anti-bot bypass
Project description
OmniFetch Python Library
Python implementation of OmniFetch - a universal content extraction library.
Features
- Universal Extraction: Fetches content from any URL, handling standard sites, SPAs, and paywalls.
- Tiered System:
- Light Fetch: Fast, standard HTTP request.
- Headless Browser: Handles dynamic JS-heavy sites (requires Netlify endpoint).
- Search Fallback: Finds alternative sources for paywalled or blocked content.
- Smart Parsing: Converts HTML to clean Markdown or JSON.
Installation
pip install omnifetch-lib
Quick Start
from omnifetch import omni_fetch
# Text extraction (Markdown)
result = omni_fetch('https://example.com', mode='TEXT')
print(result.content)
# JSON extraction (Structured Data)
json_result = omni_fetch('https://example.com', mode='JSON')
print(json_result.content['title'])
Configuration
def omni_fetch(
url: str,
mode: str = 'TEXT', # 'JSON' for structured, 'TEXT' for markdown
timeout: int = 30, # Request timeout in seconds
netlify_endpoint: str = None, # Headless browser endpoint (Tier 2)
headers: dict = None, # Custom headers
skip_headless: bool = False, # Skip Tier 2
skip_search: bool = False, # Skip Tier 3
force_title: str = None # Override title for search fallback
) -> OmniFetchResult
Advanced Usage
Handling Blocked Domains (e.g., X/Twitter)
Some domains block direct scraping. OmniFetch automatically handles this by falling back to search (Tier 3). For opaque URLs, you can provide a force_title to improve search results.
result = omni_fetch(
'https://x.com/someuser/status/12345',
mode='TEXT',
force_title='Specific Tweet Content Title' # Helps find the content via search
)
Headless Browser Support
To enable Tier 2 (Headless Browser) for dynamic sites, you need to deploy the provided Netlify function and pass the endpoint.
result = omni_fetch(
'https://dynamic-site.com',
netlify_endpoint='https://your-site.netlify.app/.netlify/functions/headless-fetch'
)
Development Installation
pip install -e .
Running Tests
pip install -e ".[dev]"
pytest
See the main README.md for full documentation.
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 omnifetch_lib-1.2.1.tar.gz.
File metadata
- Download URL: omnifetch_lib-1.2.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8e95eadb5e7ebfca1318793309b1f8ddd654ffacc762b91acbe22f3594a573
|
|
| MD5 |
97bddf43cf5bdde2a4161c73347a9c2c
|
|
| BLAKE2b-256 |
0fd641f135dece8feef343eaa33ceede60312346990b76acff72ca598bd00b39
|
Provenance
The following attestation bundles were made for omnifetch_lib-1.2.1.tar.gz:
Publisher:
publish-python.yml on visy-ani/omni-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omnifetch_lib-1.2.1.tar.gz -
Subject digest:
3f8e95eadb5e7ebfca1318793309b1f8ddd654ffacc762b91acbe22f3594a573 - Sigstore transparency entry: 986989158
- Sigstore integration time:
-
Permalink:
visy-ani/omni-fetch@6e55594310a5977e06c037de1017fcff6a61f225 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/visy-ani
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@6e55594310a5977e06c037de1017fcff6a61f225 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file omnifetch_lib-1.2.1-py3-none-any.whl.
File metadata
- Download URL: omnifetch_lib-1.2.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e554ebe096bf019df8bfbb7c8183cdc6812f2d1b0a6074c88548f9923c5d505a
|
|
| MD5 |
28832cdfd72f65d7a1521c73d62d717a
|
|
| BLAKE2b-256 |
3ddc6f9de060f15a58321542d548317a19511e595b56a9d2e9b751ee04e241d3
|
Provenance
The following attestation bundles were made for omnifetch_lib-1.2.1-py3-none-any.whl:
Publisher:
publish-python.yml on visy-ani/omni-fetch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omnifetch_lib-1.2.1-py3-none-any.whl -
Subject digest:
e554ebe096bf019df8bfbb7c8183cdc6812f2d1b0a6074c88548f9923c5d505a - Sigstore transparency entry: 986989251
- Sigstore integration time:
-
Permalink:
visy-ani/omni-fetch@6e55594310a5977e06c037de1017fcff6a61f225 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/visy-ani
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@6e55594310a5977e06c037de1017fcff6a61f225 -
Trigger Event:
workflow_dispatch
-
Statement type: