Pexels.com is a platform which provides royalty-free photos and videos.
- A Pexels API key (can be requested after sign-up)
- Docker
Note: By default, the API is rate-limited to 200 requests per hour and 20,000 requests per month. Read the Pexels Guidelines for more info.
- Pull the image.
docker pull t0shy/pexels-scraper:latest
- Run it.
Supply a JSON payload to search for a specific category. For available query parameters, see the API documentation.
docker run -it --rm \
-u $(id -u):$(id -g) \
-v $(pwd)/pexels/results:/output \
t0shy/pexels-scraper:latest \
-k "37c01053e18949935e52c0e9ddabc706166de7ca42c8357f0f4bf93e" \
-p '{"query":"Nature"}'
Note: make sure to mount to the
/output
directory on the container.
- Check the results.
|-- ./pexels/results
|-- 7203981.jpeg
|-- ...
|-- 7758348.jpeg
Note: a filename consists of
id
andoriginal
file extension.
docker run -it --rm t0shy/pexels-scraper:latest -h
_____ _ _____
| __ \ | | / ____|
| |__) |____ _____| |___ | (___ ___ _ __ __ _ _ __ ___ _ __
| ___/ _ \ \/ / _ \ / __| \___ \ / __| '__/ _` | '_ \ / _ \ '__|
| | | __/> < __/ \__ \ ____) | (__| | | (_| | |_) | __/ |
|_| \___/_/\_\___|_|___/ |_____/ \___|_| \__,_| .__/ \___|_|
| |
|_|
usage: main.py [-h] -k API_KEY -p PAYLOAD [-d] [-v]
A python command-line tool for scraping images from Pexels.com by topic search.
options:
-h, --help show this help message and exit
-k API_KEY, --key API_KEY
API key.
-p PAYLOAD, --payload PAYLOAD
Payload in JSON format.
-d, --debug Debug loglevel; Fallback to WARNING.
-v, --verbose Info loglevel.
Repository: https://github.com/ToshY/pexels-scraper
Set up pre-commit
.
pre-commit install
task contribute
Note: you can use
task black:fix
to resolve codestyle issues.
This repository comes with a MIT license.