All Projects → robvanderleek → capture-website-api

robvanderleek / capture-website-api

Licence: other
Capture screenshots of websites as a (host it yourself) API

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to capture-website-api

twitch-chat-visualizer
A Node.js Project. Would you like to see your chat stream with a custom design? This is for you!
Stars: ✭ 14 (-53.33%)
Mutual labels:  heroku, screenshot
eksi
Eksi sözlük crawl,stat , api calismalari
Stars: ✭ 25 (-16.67%)
Mutual labels:  heroku
WhiteDevil
🌀Quick Response Whatsapp Bot🌀
Stars: ✭ 45 (+50%)
Mutual labels:  heroku
sakura-card-captor-api
protected-taiga-89091.herokuapp.com/
Stars: ✭ 32 (+6.67%)
Mutual labels:  heroku
kuebikobot
A telegram bot that deploys to heroku/aws and downloads links and torrents and uploads to google drive and returns public share link
Stars: ✭ 127 (+323.33%)
Mutual labels:  heroku
VKRdownloader
Vkrdownloader: All in one Video Downloader - Download videos from facebook twitter youtube tiktok and 1000+ other sites . YouTube downloader , facebook downloader . made by Vijay Kumar
Stars: ✭ 25 (-16.67%)
Mutual labels:  heroku
ZestX-Frontend
Month-Long Fest Website ZestX with some Awsome UI and Intact Backend. Implemented admin page for user and event management
Stars: ✭ 28 (-6.67%)
Mutual labels:  heroku
imagery
Slack app to upload shared images to Imgur to save space and share easily
Stars: ✭ 29 (-3.33%)
Mutual labels:  heroku
price-tracker-bot
Telegram 聊天機器人,追蹤momo降價、重新上架
Stars: ✭ 54 (+80%)
Mutual labels:  heroku
html-to-svg
svg screenshot of web pages (saves the given URL to an SVG file)
Stars: ✭ 110 (+266.67%)
Mutual labels:  screenshot
binance-spot-order-notification-heoku
[binance order trade fill notification] Telegram Notification when Binance order created, cancelled or filled. Ready to Deploy on Heroku
Stars: ✭ 30 (+0%)
Mutual labels:  heroku
nextshot
A simple tool for taking screenshots on Linux and sharing via Nextcloud
Stars: ✭ 37 (+23.33%)
Mutual labels:  screenshot
twitter-bot-bootstrap
Template for creating a twitter bot using python (twython) and heroku
Stars: ✭ 26 (-13.33%)
Mutual labels:  heroku
electron screenshot
Node 调取微信 dll 截图
Stars: ✭ 44 (+46.67%)
Mutual labels:  screenshot
planning-poker
Effective Planning Poker sessions for remote teams
Stars: ✭ 29 (-3.33%)
Mutual labels:  heroku
ULTRA-X
No description or website provided.
Stars: ✭ 60 (+100%)
Mutual labels:  heroku
generator-vars-jekyll
Generator for raw web app with CircleCI, Jekyll, Webpack, Express + more.
Stars: ✭ 18 (-40%)
Mutual labels:  heroku
python-web-dev-21-2
Material for "Web Development in Python with Django" using Django 2.1, published as a Pearson LiveLesson on Safari Books Online
Stars: ✭ 38 (+26.67%)
Mutual labels:  heroku
Selenium-Foundation
Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).
Stars: ✭ 51 (+70%)
Mutual labels:  screenshot
screenshot
This library helps to take screenshot dynamically
Stars: ✭ 64 (+113.33%)
Mutual labels:  screenshot

Capture website API

Screenshot

Build Status BCH compliance Dependabot DockerHub image pulls Deploy

Capture screenshots of websites as a (host it yourself) API. This project is a wrapper around this library: https://github.com/sindresorhus/capture-website

Try it yourself (but beware that your screenshot is visible on a public website and the request may fail due to high traffic. Read further how prevent this):

curl 'https://capture-website-api.herokuapp.com/capture?url=https://twitter.com' -o screenshot.png

Installation

Docker

Run pre-built container from Docker Hub

  1. Pull the image:
docker pull robvanderleek/capture-website-api
  1. Start the container:
docker run -it -p 8080:8080 robvanderleek/capture-website-api
  1. Make screenshot test request:
curl 'localhost:8080/capture?url=https://news.ycombinator.com/' -o screenshot.png

Build the docker image and run it

  1. Clone the repo:
git clone [email protected]:robvanderleek/capture-website-api.git && cd capture-website-api
  1. Build the image:
docker build -t cwa .
  1. Start the container:
docker run -it -p 8080:8080 cwa
  1. Make screenshot test request:
curl 'localhost:8080/capture?url=https://www.youtube.com' -o screenshot.png

Yarn

Run in a terminal:

  1. Clone the repo:
git clone [email protected]:robvanderleek/capture-website-api.git && cd capture-website-api
  1. Install dependencies:
yarn
  1. Start the server:
yarn start
  1. Make screenshot test request:
curl 'localhost:8080/capture?url=https://www.reddit.com' -o screenshot.png

Heroku

Deploy and run on Heroku:

  1. Clone the repo:
git clone [email protected]:robvanderleek/capture-website-api.git && cd capture-website-api
  1. Login to the Heroku container repository:
heroku container:login
  1. Create repository entry:
heroku create
  1. Push container:
heroku container:push web
  1. Release container:
heroku container:release web
  1. Get Heroku endpoint:
CWA_URL=$(heroku info -s | grep web_url | cut -d= -f2) 
  1. Make screenshot test request:
curl "${CWA_URL}capture?url=https://www.linkedin.com" -o screenshot.png

Usage

Call the /capture endpoint and pass the site URL using the query parameters url:

$ curl 'https://capture-website-api.herokuapp.com/capture?url=http://gmail.com' -o screenshot.png

Simple as that.

Configuration

Application options

Application configuration options can be set as environment veriables or in a .env file in the root folder. There's an example .env file in the codebase: .env.example

Supported options are:

Name Descrition Default
TIMEOUT Timeout in seconds for loading a web page 20
CONCURRENCY Number of captures that run in parallel, more memory allows more captures to run in parallel 2
MAX_QUEUE_LENGTH Requests that can't be handled directly are queued until the queue is full 6
SHOW_RESULTS Enable web endpoint to show latest capture false
SECRET Secret string to prevent undesired usage on public endpoints ""

Capturing options

Most of the configuration options from the wrapped capture-website library are supported using query parameters. For example, to capture a site with a 650x350 viewport, no default background and animations disabled use:

curl 'https://capture-website-api.herokuapp.com/capture?url=http://amazon.com&width=650&height=350&scaleFactor=1&defaultBackground=false&disableAnimations=true' -o screenshot.png

See https://github.com/sindresorhus/capture-website for a full list of options.

Use plain Puppeteer

Sometimes the capture-website library has problems capturing sites. You can try to capture these sites with plain Puppeteer by supplying the query parameter plainPuppeteer=true

Environment variables

This app looks at two environment variables:

  • SHOW_RESULTS: if true the latest capture result can be viewed in the browser by browsing the base url (e.g.: https://capture-website-api.herokuapp.com/)
  • SECRET: when set all capture requests need to contain a query parameter secret whose value matches the value of this environment variable

Contributing

If you have suggestions for improvements, or want to report a bug, open an issue!

License

ISC © 2019 Rob van der Leek [email protected] (https://twitter.com/robvanderleek)

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].