A Pinterest media downloader
Project description
Pinterest-dowenloader
This Python library allows you to search for images on Pinterest and download them asynchronously. It uses asynchronous programming to efficiently search and download multiple images concurrently.
Features
- Search Pinterest for images based on a query
- Download images and videos from Pinterest
- Asynchronous operations for improved performance
- Customizable output directory and maximum number of results
- Supports both image and video content from Pinterest
Requirements
- Python 3.7+
- aiohttp
Installation
You can install this package using pip:
pip install Pinterest-dowenloader
Usage
You can use this library in your Python projects by importing the necessary functions:
import asyncio
from Pinterest_dowenloader import search_and_download_pinterest
async def main():
query = "cute cats"
output_dir = "pinterest_downloads"
max_results = 5
results = await search_and_download_pinterest(query, output_dir, max_results)
print(f"Downloaded {len(results)} images/videos for query: '{query}'")
for result in results:
print(f"Type: {result['type']}, File: {result.get('file_path', result.get('url'))}")
if __name__ == "__main__":
asyncio.run(main())
Available Functions
-
pinterest_search(query: str) -> List[Dict[str, str]]- Searches Pinterest for images based on the given query.
- Returns a list of dictionaries containing image URLs and thumbnails.
-
download_pinterest_media(url: str, output_dir: str = '.', return_url: bool = False) -> Dict[str, Any]- Downloads a single image or video from Pinterest.
- Returns a dictionary with information about the downloaded media.
-
search_and_download_pinterest(query: str, output_dir: str = '.', max_results: int = 5) -> List[Dict[str, Any]]- Combines search and download functionality.
- Returns a list of dictionaries with information about the downloaded media.
Configuration
You can customize the following parameters when calling search_and_download_pinterest:
query: The search term for Pinterest imagesoutput_dir: The directory where downloaded images will be savedmax_results: The maximum number of images to download
Limitations
- The script relies on Pinterest's current HTML structure and API. Changes to Pinterest's website may require updates to the script.
- Pinterest may rate-limit or block excessive requests. Use responsibly and consider adding delays between requests if necessary.
- Some images or videos may not be downloadable due to privacy settings or other restrictions.
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 pinterest_downloader-2.0.0.tar.gz.
File metadata
- Download URL: pinterest_downloader-2.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2405030035f93b4fc785b6db6f7022d66e5341b246dd771949e753b5ae5ccd56
|
|
| MD5 |
c65c57f0ac05de073351aff0d576889f
|
|
| BLAKE2b-256 |
18b95d8c7b408913bc3536f8ff06df535185991f8247a9cff7393acc39e1d7e8
|
File details
Details for the file pinterest_downloader-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pinterest_downloader-2.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dac1897bf4e6f7c6cb105c80e885b0fc57e2f2db651958b7a8b759a6eb48302
|
|
| MD5 |
c184b36b25240bb0c95fbedb6dfc8ee1
|
|
| BLAKE2b-256 |
e058e26b4facf610ca12d6e3f9fdbd7a75cd100023f72b36d153fb2fa07d4072
|