@deegeemee/tweetshot
v0.0.2
Published
A Node.js library to take screenshots of tweets
Downloads
1
Readme
@deegeemee/tweetshot
A Node.js library to take screenshots of tweets
Installation
npm install @deegeemee/tweetshot
Usage
import { tweetShot } from '@deegeemee/tweetshot';
const tweetUrl = 'https://x.com/deegeemeeonx/status/1772271871909581245';
tweetShot({ tweetUrl }).then((buffer) => {
// Buffer is a Buffer
});
Or if you want to save the screenshot to a file:
import { tweetShot } from '@deegeemee/tweetshot';
const tweetUrl = 'https://x.com/deegeemeeonx/status/1772271871909581245';
tweetShot({ tweetUrl, outFile: 'output.webp' }).then((output) => {
// output is a sharp.OutputInfo
});
API
tweetShot(params: TweetShotParams)
Performs screenshot of a tweet
Parameters
| Name | Type | Description | Default |
| ---------------- | ------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| tweetUrl | string | Tweet URL to screenshot | N/A |
| outFile | string | File to save the screenshot to. | N/A |
| browser | Browser | Browser to use for screenshotting. | N/A |
| chromeExecutable | string | Path to the Chrome executable. | CHROME_BIN environment variable |
| hideMedia | boolean | Hides the media in the tweet. | false |
| hideThread | boolean | Hides the thread in the tweet. | false |
| lang | string | Language to use. See supported languages. | 'en' |
| theme | string | The theme of the tweet. | 'dark' |
| imageWidth | number | Width of the image to screenshot. Must be 220-550 | 550 |
| imageType | string | Image type to use. Can be 'webp' \| 'jpeg' \| 'png'
| 'webp' |
| imageQuality | number | Image quality to use. Value 0 - 100, not applicable for 'png'
| 100 |
npm scripts
npm run build
- Builds the librarynpm run test
- Runs the testsnpm run test:watch
- Runs the tests in watch modenpm run lint
- Runs the linter