A Pinterest image search and download client
Project description
Pyntrest
A powerful Pinterest image search and download client with CLI and API support.
Features
- Search and download Pinterest images
- Command-line interface
- FastAPI server with web interface
- Multiple search modes:
- Regular search
- Random images
- Inspiration images
- Single image quick search
- Download functionality
- Session management with cookie refresh
- User agent rotation to prevent rate limiting
- Easy to use as a Python library
Installation
# From PyPI (coming soon)
pip install pyntrest
# From GitHub
git clone https://github.com/redmoon0x/pynterest.git
cd pynterest
pip install -e .
Command Line Usage
Search and download images:
# Basic search
pyntrest-search "cats" -n 5
# Download to specific directory
pyntrest-search "dogs" -n 3 -o dog_pics
# Get random images
pyntrest-search random "nature" -n 2
# Get random inspiration images
pyntrest-search inspire -n 3
Web Interface
Start the web server:
pyntrest-server
Then open http://localhost:8000 in your browser to use the web interface.
API Usage
As a Python Library
from pyntrest import PinterestClient
# Initialize the client
client = PinterestClient()
# Search for images
images = client.get_image_links("cats", num_images=3)
for img in images:
print(f"URL: {img['url']}")
print(f"Size: {img['width']}x{img['height']}")
print(f"Title: {img['title']}")
print(f"Description: {img['description']}")
# Get a single image quickly
image = client.get_one_image("dogs")
print(image['url'])
# Get a random inspiration image
image = client.get_random_inspiration()
print(image['url'])
REST API Endpoints
The web server provides these endpoints:
GET /api/search/?query=<term>&num=<count>- Search for imagesGET /api/random/?query=<term>- Get a random image for queryGET /api/one/?query=<term>- Get a single image quicklyGET /api/inspire/- Get a random inspiration imageGET /api/download/?url=<image_url>- Download an image
Example using curl:
# Search for images
curl "http://localhost:8000/api/search/?query=cats&num=3"
# Get a random image
curl "http://localhost:8000/api/random/?query=dogs"
# Get an inspiration
curl "http://localhost:8000/api/inspire/"
Project Structure
pyntrest/
├── client/ # Core Pinterest client
│ ├── __init__.py
│ └── pinterest.py
├── api/ # FastAPI server
│ ├── __init__.py
│ └── server.py
├── web/ # Web interface
│ └── static/ # Frontend files
├── __init__.py # Package initialization
└── cli.py # Command line interface
Development
- Clone the repository
- Install development dependencies:
pip install -r requirements.txt
- Run tests:
pytest
License
MIT License - see LICENSE file for details.
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 pyntrest-1.0.0.tar.gz.
File metadata
- Download URL: pyntrest-1.0.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
469e25fd8851006b67f18168e68f6d6dc6f739ac362235c2d9204912a79b67a0
|
|
| MD5 |
91c819a7acea0c1ae2239a1b6d19d893
|
|
| BLAKE2b-256 |
e6e4acea38f9afc13f1e3f955c7bee8be70eae5b10540cfe47fcf6764bd7dbab
|
File details
Details for the file pyntrest-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyntrest-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c4fd2afffc75ba5e4a238d3035e79c288a5161bd689fa6ba523e1dfdad6587
|
|
| MD5 |
dfe31f159aa22f9cf0b6eee082741001
|
|
| BLAKE2b-256 |
c0f129e17a0912ff7522030e6b1b5fd861f385de786f7eab24ab9d9ea759e2f9
|