Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lukehorvat/screenshot-tweet

Screenshot a tweet.
https://github.com/lukehorvat/screenshot-tweet

image screenshot tweet twitter

Last synced: 3 months ago
JSON representation

Screenshot a tweet.

Awesome Lists containing this project

README

        

# screenshot-tweet [![NPM version](http://img.shields.io/npm/v/screenshot-tweet.svg?style=flat-square)](https://www.npmjs.org/package/screenshot-tweet)

Screenshot a Twitter tweet.

![](https://i.imgur.com/dwSuivL.png)

## Installation

Install the package with NPM:

```bash
$ 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:

```javascript
import screenshotTweet from "screenshot-tweet";

screenshotTweet(
"https://twitter.com/reactjs/status/912712906407501825",
"tweet.jpg"
).then(() => {
console.log("Success");
}).catch(error => {
console.error("Error");
});
```

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:

```bash
$ screenshot-tweet TWEET_URL FILE_PATH
```

Example:

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