Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

urlbox-next

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlbox-next

Generate screenshots with node.js using the urlbox.io screenshot as a service API

  • 2.0.0
  • next
  • npm
  • Socket score

Version published
Weekly downloads
24
increased by14.29%
Maintainers
1
Weekly downloads
 
Created
Source

urlbox-screenshots

Quickly generate screenshots using the urlbox.io screenshot as a service API.

Signup at Urlbox.io to get your API key and secret.

Installation

npm install urlbox --save

Example

import Urlbox from 'urlbox';

// Get your API key and secret from urlbox.io
const urlbox = Urlbox(YOUR_API_KEY, YOUR_API_SECRET);

// See all urlbox screenshot options at urlbox.io/docs
const options = {
  url: 'github.com',
  thumb_width: 600,
  format: 'jpg',
  quality: 80
}

const imgUrl = urlbox.buildUrl(options);
// https://api.urlbox.io/v1/YOUR_API_KEY/TOKEN/jpg?url=github.com&thumb_width=600&quality=80

Now stick that url in an img tag to render the screenshot!

Urlbox Screenshot of github.com

Available options:

OptionDefaultDescription
url-The URL of the website you want to screenshot
width1280Viewport width of the browser in pixels
height1024Viewport height of the browser in pixels
selector-Take a screenshot of the element that matches this selector
thumb_width-Width in pixels of the generated thumbnail, leave off for full-size screenshot
formatpngFormat of the resulting screenshot image (png or jpg)
user_agent-User-Agent string used to emulate a particular client.
cookie-Set a cookie value before taking a screenshot. E.g. OptIn=true. Can be set multiple times to set more than one cookie.
delay-Amount of time to wait in milliseconds before urlbox takes the screenshot
wait_for-Waits for the element specified by this selector to be visible on the page before taking a screenshot
timeout30000Amount of time to wait in milliseconds for the website at url to respond
full_pagefalseSpecify whether to capture the full-length of the website
flashfalseEnable the flash plugin for flash using websites
forcefalseTake a fresh screenshot instead of getting a cached version
ttl2592000 (30 days)Short for 'time to live'. Number of seconds to keep a screenshot in the cache. Note the default is also the maximum value for this option.
quality80JPEG only - image quality of resulting screenshot (0-100)
disable_jsfalseTurn off javascript on target url to prevent popups
retinafalseTake a 'retina' or high definition screenshot equivalent to setting a device pixel ratio of 2.0 or @2x. Please note that retina screenshots will be double the normal dimensions and will normally take slightly longer to process due to the much bigger image size.
click-Element selector that is clicked before taking a screenshot e.g. #clickme would click the element with id="clickme"
hover-Element selector that is hovered before taking a screenshot e.g. #hoverme would hover over the element with id="clickme"
bg_color-Hex code or css color string. Some websites don't set a body background colour, and will show up as transparent backgrounds with PNG or black when using JPG. Use this setting to set a background colour. If the website explicitly sets a transparent background on the html or body elements, this setting will be overridden.
crop_width-Crop the width of the screenshot to this size in pixels
hide_selector-Hides all elements that match the element selector by setting their style to display:none !important;. Useful for hiding popups.
highlight-Word to highlight on the page before capturing a screenshot
highlightfgwhiteText color of the highlighted word
highlightbgredBackground color of the highlighted word
use_s3falseSave the screenshot directly to the S3 bucket configured on your account

Keywords

FAQs

Package last updated on 06 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc