Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpbede/ratiocheck

Microservice to check image to content ratio of HTML pages
https://github.com/jpbede/ratiocheck

Last synced: 8 days ago
JSON representation

Microservice to check image to content ratio of HTML pages

Awesome Lists containing this project

README

        

# 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](https://github.com/jpbede/ratiocheck/releases).

### Docker
```shell
docker run -p 3000:3000 ghcr.io/jpbede/ratiocheck:latest
```

or via `docker-compose.yml`

```yaml
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:

```shell
ratiocheck check
```

### REST API

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

```json
{
"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:

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

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

```json
{
"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:

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