Skip to content

Microservice to check image to content ratio of HTML pages

License

Notifications You must be signed in to change notification settings

jpbede/ratiocheck

Repository files navigation

ratiocheck

Microservice to check image to content ratio of HTML pages

Requirements

When running outside the docker container a Chrome installation is required.

Installing

Binaries

You find pre-compiled binaries and packages for the most common OS under the releases.

Docker

docker run -p 3000:3000 ghcr.io/jpbede/ratiocheck:latest

or via docker-compose.yml

version: "3"
services:
  ratiocheck:
    image: ghcr.io/jpbede/ratiocheck:latest
    ports:
      - 3000:3000

macOS

Simply use homebrew (https://brew.sh/)

To install ratiocheck use following command brew install jpbede/tap/ratiocheck

Using it

Shell

You can run a check by issuing following command:

ratiocheck check <url to check>

REST API

HTML

Do an HTTP POST call to /html endpoint with following JSON body:

{
  "html": "<your html>"
}

As a result you will get the ratio image area to content area, the size of the content area and the size of the image area:

{
  "content_area": 1591200,
  "image_area": 948332,
  "ratio": 59.598541980894915
}

URL

Do an HTTP POST call to /url endpoint with following JSON body:

{
  "url": "<your url>"
}

As a result you will get the ratio image area to content area, the size of the content area and the size of the image area:

{
  "content_area": 1591200,
  "image_area": 948332,
  "ratio": 59.598541980894915
}

About

Microservice to check image to content ratio of HTML pages

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages