项目作者: lukehorvat

项目描述 :
Screenshot a tweet.
高级语言: JavaScript
项目地址: git://github.com/lukehorvat/screenshot-tweet.git
创建时间: 2016-12-10T03:29:16Z
项目社区:https://github.com/lukehorvat/screenshot-tweet

开源协议:MIT License

下载


screenshot-tweet NPM version

Screenshot a Twitter tweet.

Installation

Install the package with NPM:

  1. $ npm install -g screenshot-tweet

The -g flag is recommended for easy CLI usage, but completely optional.

API

The package exposes a function with the signature (tweetUrl, filePath), where tweetUrl is the URL of the tweet and filePath is the filesystem location to save the screenshot at. Returns a Promise.

Example:

  1. import screenshotTweet from "screenshot-tweet";
  2. screenshotTweet(
  3. "https://twitter.com/reactjs/status/912712906407501825",
  4. "tweet.jpg"
  5. ).then(() => {
  6. console.log("Success");
  7. }).catch(error => {
  8. console.error("Error");
  9. });

If filePath is omitted, the Promise will resolve with a Buffer containing the screenshot data.

CLI

Execute screenshot-tweet from the command line with the following arguments:

  1. $ screenshot-tweet TWEET_URL FILE_PATH

Example:

  1. $ screenshot-tweet https://twitter.com/reactjs/status/912712906407501825 tweet.jpg