Skip to content

A tiny Falcon app for requesting images with cloudscraper and returning the image data as a base64 string.

License

Notifications You must be signed in to change notification settings

ToshY/cloudscraper-image

Repository files navigation

🖼️ Cloudscraper for images

GitHub release (latest SemVer) Docker Hub repository Pylint Pip Audit Code style: black

A tiny Falcon app for requesting images with cloudscraper and returning the image data as a base64 string.

Setup

You can choose to either follow the Docker route or plain (Python) route.

🐋 Docker

Pull or build

docker pull t0shy/cloudscraper-image:latest
# or
docker build -t t0shy/cloudscraper-image:latest --no-cache .

🐍 Plain

Install the requirements with pip.

pip install -r requirements.txt

Run webserver

🐋 Docker

docker run -dit --name cloudscraper-image t0shy/cloudscraper-image:latest

Note: You can remove the container after usage:

docker rm -f cloudscraper-image

🐍 Plain

python setup.py

📨 Request

🐋 Docker

curl http://<container-ip>:8000/image?url=<encoded-url>

Note: You can get the IP address of the container by running the following command:

docker inspect --format "{{ .NetworkSettings.IPAddress }}" cloudscraper-image

🐍 Plain

curl http://127.0.0.1:8000/image?url=<encoded-url>

📬 Response

The response will be a base64 string. To test/verify if this data is correct, you can use tools like Base64.guru to convert it back to an image.

🛠️ Contribute

To simplify development, a Taskfile.yml is included. While the usage is optional, Task simplifies the setup for your development environment. Installation guide for Task can be found at taskfile.dev/installation.

Pre-commit

Setting up pre-commit code style & quality checks for local development.

pre-commit install

Create container

task up

Quality & Code Style

task check

Code Style fix

task fix