Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/lukehorvat/screenshot-tweet
- Owner: lukehorvat
- License: mit
- Created: 2016-12-10T03:29:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-17T19:34:35.000Z (over 4 years ago)
- Last Synced: 2024-07-17T21:39:19.423Z (4 months ago)
- Topics: image, screenshot, tweet, twitter
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 66
- Watchers: 3
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```