https://github.com/natlee/pyppesnap
Get a snapshot from a website by using Pyppeteer.
https://github.com/natlee/pyppesnap
base64 cli cli-app cli-tool image pdf pyppeteer python screenshot snapshot webscraping
Last synced: about 1 year ago
JSON representation
Get a snapshot from a website by using Pyppeteer.
- Host: GitHub
- URL: https://github.com/natlee/pyppesnap
- Owner: NatLee
- License: mit
- Created: 2022-09-03T11:17:42.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-03T18:53:19.000Z (almost 4 years ago)
- Last Synced: 2024-11-17T01:46:16.109Z (over 1 year ago)
- Topics: base64, cli, cli-app, cli-tool, image, pdf, pyppeteer, python, screenshot, snapshot, webscraping
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyppeSnap
[](https://github.com/NatLee/PyppeSnap/actions/workflows/test.yml)[](https://github.com/NatLee/PyppeSnap/actions/workflows/release.yml)


This is a tool for getting snapshot with base64 encoding from a website.
As DEMO image you see, just need one URL input to function.
This package support `image` and `pdf` with encoded base64.
## Installation
```bash
pip install pyppesnap
```
Check it on [Pypi](https://pypi.org/project/PyppeSnap/).
## Usage
Common use with code below.
- Get image
```python
from pyppesnap import get_image_snapshot_by_url
url = 'https://www.google.com'
print(get_image_snapshot_by_url(url))
```
- Get PDF
```python
from pyppesnap import get_pdf_snapshot_by_url
url = 'https://www.google.com'
print(get_pdf_snapshot_by_url(url))
```
> You need to give a valid URL like start with `http`, or Pyppeteer cannot navigate it.
- CLI
You can try CLI mode for testing.
```bash
pyppesnap --url https://www.google.com --type img
```
And the output here.
```
------------- Parameters ---------------
URL: https://www.google.com
Type: img
--------------- Base64 ------------------
iVBORw0KGgoAAAANSUhEUgAABkAAAAOECAYAAAD
...
CCAAAAAAAkM7/B83ojRnTa7oSAAAAAElFTkSuQmCC
-------------------------------------
```
This tool can be used with web framworks to get a snapshot, check details in [./example](https://github.com/NatLee/PyppeSnap/tree/main/example).