All Projects → gen2brain → Url2img

gen2brain / Url2img

Licence: gpl-3.0
HTTP server with API for capturing screenshots of websites

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Url2img

Phpchrometopdf
A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface
Stars: ✭ 127 (-74.34%)
Mutual labels:  screenshot, headless
Gowitness
🔍 gowitness - a golang, web screenshot utility using Chrome Headless
Stars: ✭ 996 (+101.21%)
Mutual labels:  screenshot, headless
Puppetron
Puppeteer (Headless Chrome Node API)-based rendering solution.
Stars: ✭ 429 (-13.33%)
Mutual labels:  screenshot, headless
urlbox-screenshots-node
Capture website thumbnails using the urlbox.io screenshot as a service API in node
Stars: ✭ 14 (-97.17%)
Mutual labels:  screenshot, headless
Libhttpserver
C++ library for creating an embedded Rest HTTP server (and more)
Stars: ✭ 464 (-6.26%)
Mutual labels:  http-server
Chrome Har Capturer
Capture HAR files from a Chrome instance
Stars: ✭ 423 (-14.55%)
Mutual labels:  headless
Docker Puppeteer
docker image with Google Puppeteer installed
Stars: ✭ 415 (-16.16%)
Mutual labels:  screenshot
1click Webpage Screenshot
Entire page Screenshot extension for Google Chrome. I'm developing open source extension for Google Chrome. All extension are free for use. Let's make Chrome great again!
Stars: ✭ 406 (-17.98%)
Mutual labels:  screenshot
Proxy admin free
Proxy是高性能全功能的http代理、https代理、socks5代理、内网穿透、内网穿透p2p、内网穿透代理、内网穿透反向代理、内网穿透服务器、Websocket代理、TCP代理、UDP代理、DNS代理、DNS加密代理,代理API认证,全能跨平台代理服务器。
Stars: ✭ 487 (-1.62%)
Mutual labels:  http-server
Chromda
λ 🖼️ Chromda is an AWS Lambda function for capturing screenshots of websites.
Stars: ✭ 481 (-2.83%)
Mutual labels:  screenshot
Dataflowkit
Extract structured data from web sites. Web sites scraping.
Stars: ✭ 456 (-7.88%)
Mutual labels:  headless
Storycap
A Storybook Addon, Save the screenshot image of your stories 📷 via puppeteer.
Stars: ✭ 451 (-8.89%)
Mutual labels:  screenshot
Pychrome
A Python Package for the Google Chrome Dev Protocol [threading base]
Stars: ✭ 469 (-5.25%)
Mutual labels:  headless
Flutter workmanager
A Flutter plugin which allows you to execute code in the background on Android and iOS.
Stars: ✭ 417 (-15.76%)
Mutual labels:  headless
Facebooc
Yet another Facebook clone written in C
Stars: ✭ 483 (-2.42%)
Mutual labels:  http-server
Hydra
后端一站式微服务框架,提供API、web、websocket,RPC、任务调度、消息消费服务器
Stars: ✭ 407 (-17.78%)
Mutual labels:  http-server
Ffcast
Run command on rectangular screen regions
Stars: ✭ 478 (-3.43%)
Mutual labels:  screenshot
Shotlooter
a recon tool that finds sensitive data inside the screenshots uploaded to prnt.sc
Stars: ✭ 451 (-8.89%)
Mutual labels:  screenshot
Flextype
Hybrid Content Management System with the freedom of a headless CMS and with the full functionality of a traditional CMS
Stars: ✭ 436 (-11.92%)
Mutual labels:  headless
App
Directus Admin Application — An Intuitive WebApp for Managing Database Content
Stars: ✭ 464 (-6.26%)
Mutual labels:  headless

url2img

url2img is HTTP server with API for capturing screenshots of websites.

Example (command line):

$ curl -s http://localhost:55888/?url=google.com > google.jpg

Example (web browser):

http://localhost:55888/?url=google.com&output=html

API

Name Type Default Description
url string Target URL (required), http(s):// prefix is optional
output string raw Output format (raw, base64, html)
format string jpg Image format (jpg, png)
ua string User-Agent string
quality int 85 Image quality
delay int 0 Delay screenshot after page is loaded (milliseconds)
width int 1600 Viewport width
height int 1200 Viewport height
zoom float 1.0 Zoom factor
full bool false Capture full page height

Usage

Usage of url2img:

  -bind-addr string
        Bind address (default ":55888")
  -cache-dir string
        Path to cache directory, if empty caching is disabled
  -htpasswd-file string
        Path to htpasswd file, if empty auth is disabled
  -log-file string
        Path to log file, if empty logs to stdout
  -max-age int
        Cache maximum age (seconds) (default 86400)
  -read-timeout int
        Read timeout (seconds) (default 5)
  -write-timeout int
        Write timeout (seconds) (default 15)

Auth

If server is started with -htpasswd-file it will be protected with HTTP Basic Auth. Supports MD5, SHA1 and BCrypt (https://github.com/abbot/go-http-auth).

Examples:

$ htpasswd -c .htpasswd username
$ url2img -htpasswd-file .htpasswd

$ curl -I 'http://localhost:55888/?url=google.com'

HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Www-Authenticate: Basic realm="url2img/1.0"
X-Content-Type-Options: nosniff
Date: Wed, 09 Nov 2016 17:50:33 GMT
Content-Length: 17

$ curl -u username:password -s http://localhost:55888/?url=google.com > google.jpg
$ curl -s http://username:[email protected]:55888/?url=google.com > google.jpg
$ curl --netrc-file my-password-file http://localhost:55888/?url=google.com > google.jpg

Cache

If server is started with -cache-dir it will cache HTTP responses to disk according to RFC7234 (https://github.com/lox/httpcache). You can use -max-age to control maximum age of cache file, default is 86400 seconds (1 day).

Example:

$ curl -I 'http://localhost:55888/?url=https://reddit.com'

HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 21
Cache-Control: public,max-age=86400
Content-Length: 21107
Content-Type: image/jpeg
Last-Modified: Wed, 09 Nov 2016 18:25:26 GMT
Proxy-Date: Wed, 09 Nov 2016 17:25:26 GMT
Server: url2img/1.0
Via: 1.1 httpcache
X-Cache: HIT
Date: Wed, 09 Nov 2016 17:25:47 GMT

If you want uncached response you can request it via Cache-Control header:

$ curl -H 'Cache-Control: no-cache' 'http://localhost:55888/?url=https://reddit.com'

Or you can send POST request with json body, POST requests are never cached:

$ curl -X POST -d '{"url": "https://reddit.com", "format": "png"}' http://localhost:55888

Reload

To reload server (e.g. when .htpasswd is changed or log file is rotated) send SIGHUP signal to process. If you use one of the provided init scripts just do a reload.

Download

Binary is compiled fully static with musl toolchain. It should work on all systems without any additional dependencies. Systemd and OpenRC init scripts are included in dist/.

Alternative: run in Docker container

An alternative is to run everything in a container. Change to the dist/docker directory and:

# Build container: `docker build -t url2img .`
# Then run container: `docker run -p 55888:55888 url2img`

Output should be like this:

$ docker run -p 55888:55888 url2img
running server on port 55888

Compile

Install Qt bindings (https://github.com/therecipe/qt) with WebKit (see https://github.com/therecipe/qt/wiki/Installing-QtWebKit-Module).

Install url2img to $GOPATH/bin:

$ go get -d github.com/gen2brain/url2img
$ go generate github.com/gen2brain/url2img/url2img
$ qtminimal linux $GOPATH/src/github.com/gen2brain/url2img/url2img
$ go install -tags minimal github.com/gen2brain/url2img/cmd/url2img

License

url2img is free/libre software released under the terms of the GNU GPL license, see the 'COPYING' file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].