0.0.2 • Published 11 months ago

@deegeemee/tweetshot v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@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

NameTypeDescriptionDefault
tweetUrlstringTweet URL to screenshotN/A
outFilestringFile to save the screenshot to.N/A
browserBrowserBrowser to use for screenshotting.N/A
chromeExecutablestringPath to the Chrome executable.CHROME_BIN environment variable
hideMediabooleanHides the media in the tweet.false
hideThreadbooleanHides the thread in the tweet.false
langstringLanguage to use. See supported languages.'en'
themestringThe theme of the tweet.'dark'
imageWidthnumberWidth of the image to screenshot. Must be 220-550550
imageTypestringImage type to use. Can be 'webp' \| 'jpeg' \| 'png''webp'
imageQualitynumberImage quality to use. Value 0 - 100, not applicable for 'png'100

npm scripts

npm run build - Builds the library
npm run test - Runs the tests
npm run test:watch - Runs the tests in watch mode
npm run lint - Runs the linter

0.0.2

11 months ago

0.0.1

11 months ago