Scrape only the content from a webpage using Firefox's reader view.
Project description
Webpage Content Scraper
Scrape only the content from a webpage using Firefox's reader view.
Installation
Install this library using pip:
pip install webpage-content-scraper
Then install the Firefox browser for Playwright:
playwright install firefox
Usage
Simply supply a list of pages and optionally, a format and timeout.
from webpage_content_scraper import fetch_page_content, Formats
urls = [
'https://microsoft.github.io/autogen/blog/2024/03/03/AutoGen-Update',
'https://microsoft.github.io/autogen/blog/2024/02/29/StateFlow',
'https://microsoft.github.io/autogen/blog/2024/02/11/FSM-GroupChat'
]
blog_posts = fetch_page_content(urls, Formats.MARKDOWN)
for post in blog_posts:
print(f'\n---start---\n{post}\n---end---\n')
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd python-webpage-content-scraper
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
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 webpage_content_scraper-0.3.tar.gz.
File metadata
- Download URL: webpage_content_scraper-0.3.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0f25343d7bf2b5e729e7c7697c427498dbae5df7474b512e19913fe24b7bdde
|
|
| MD5 |
8b4f3231e44c0092d89f9987c0aea0f0
|
|
| BLAKE2b-256 |
ae98aa24ffa178c4120f218dd3bb9efac16961d8b6851789b0f9d0ccfd77a800
|
File details
Details for the file webpage_content_scraper-0.3-py3-none-any.whl.
File metadata
- Download URL: webpage_content_scraper-0.3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2b6733a9c884f8347d8ac3df809bc738c677047ffa6c0b546c9b582b9584685
|
|
| MD5 |
be8a4ea9f100694c6572b85ea07cb510
|
|
| BLAKE2b-256 |
5a8a83bd9d419710328a4d81361db05cc470e5a3b58d36bd1b539f110288d906
|