# screenerx

> Batch create screenshots of websites

Latest version **1.1.1** (published 2023-05-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install screenerx
pnpm add screenerx
yarn add screenerx
bun add screenerx
```

Provides the command `screenerx`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-05-21 |
| First published | 2023-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Milawski |
| Maintainers | milawski |
| Keywords | screenshot, webpage, batch, automation, puppeteer, yargs, cli |

## Links

- npm: https://www.npmjs.com/package/screenerx
- Repository: https://github.com/millsoft/screenerx
- Homepage: https://github.com/millsoft/screenerx#readme
- Issues: https://github.com/millsoft/screenerx/issues
- npm.io page: https://npm.io/package/screenerx

## Dependencies (2)

- [yargs](https://npm.io/package/yargs.md) ^17.7.1
- [puppeteer](https://npm.io/package/puppeteer.md) ^19.9.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2023-05-21
- 1.1.0 — 2023-05-20
- 1.0.1 — 2023-04-22
- 1.0.0 — 2023-04-22

## README

# Screenerx

This nodejs project will create batch screenshots of websites.
It uses the awesome puppeteer library which uses a real browser under the hood, e.g. a Chrome or Firefox.

## Installation

```bash
npm install -g screenerx
# or:
yarn global add screenerx
# or use docker (see below)
```

## Usage

### Use arguments

You can call screenerx with arguments:


#### Examples
```bash
# create a screenshot with default settings
screenerx --url https://example.com

# set width and height
screenerx --url https://example.com --width=1200 --height=800

# create a full page screenshot
screenerx --url https://example.com --width=1200 --height=full

# set output path
screenerx --url https://example.com --width=1200 --height=800 --output-path=screenshots/test

# set output file (if not set, the url will be used)
screenerx --url https://example.com --width=1200 --height=800 --output-path=screenshots/test --output-file=example.jpg

# pass an url via stdin (e.g. from a file or echo)
echo "https://example.com" | xargs -I {} ./screenerx.js --url={}
 
# create screenshots in parallel (using gnu-parallel) with 4 threads: 
cat links.txt | parallel --line-buffer -j 4 screenerx --url {}

# docker example (see below for more information)
cat links.txt | parallel --line-buffer -j 4 docker-compose run --rm screenerx --url {}

# specify a link file, default is links.txt (link file is ignored if you specify an url!)
screenerx --file=links.txt
```

### Create a config file

If you like, you can also create a config file. The config file will be used to generate the screenshots.

create a file called `screenerconf.json`, you can see at `screenerconf.json.example` for an example.
An entry looks basically like this:

```json
{
    "linkFile" : "links.txt",
    "tasks": [
        {
            "name" : "test_landscape",
            "enabled" : true,
            "baseUrl" : "https://www.example.com",
            "linkFile" : "links.txt",
            "browser" : "chrome",
            "width" : "1920",
            "height" : "1080"
        }
    ]
}
```

| prop     | description                                                                                                     |
|----------|-----------------------------------------------------------------------------------------------------------------|
| name     | name of the task, this will be used in directory name                                                           |
| enabled  | should this task run?                                                                                           |
| baseUrl  | if you specify a baseUrl, you can use paths only in your urlfile                                                |
| browser  | chrome, firefox, etc.. Default is chrome, if you need another browsers, see puppeteer docs how to install these |
| width    | width of the screen                                                                                             |
| height   | height of the screen, can be also "full" to create full size screenshots                                        |
| linkFile | set a different link file for this job                                                                          |

create a text file and put your links into that file. For example `links.txt` (as specified above in json)
The link list can be a normal list with full URLs starting with http://, https:// or you can also only specify the paths. for example /about. The full URL will be generated out of provided baseUrl in `screenerx.conf.json` and the provided path in links.txt
You can specify the linkFile in the root of the json file, but you can also specify / override it in the task itself.

The screenshots will be made in the screenshot folder.


## Docker

You can also use this tool in a docker container.
Just build the container with `docker build -t screenerx .` and run it with `docker run -it --rm -v $(pwd):/app/screenshots screenerx`

or use the docker-compose file:

```bash
docker-compose run --rm screenerx
```

## License
MIT

## Author
Michael Milawski

---
_Source: https://npm.io/package/screenerx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
