GithubHelp home page GithubHelp logo

screenshot-tweet's Introduction

screenshot-tweet NPM version

Screenshot a Twitter tweet.

Installation

Install the package with NPM:

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

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:

$ screenshot-tweet TWEET_URL FILE_PATH

Example:

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

screenshot-tweet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

screenshot-tweet's Issues

More verbose error reporting?

Hi there, big thanks for a really, really useful bit of code. I've had this successfully running in CLI and in a little script I wrote but now it's stopped working on both.

I'm getting "an unexpected error occurred" on the CLI after it tries to grab the screenshot.

I'm guessing this could be either through Twitter's rate limiting or something else going on but no idea how to start debugging it because I'm not getting any pointers.

Any ideas?

Thanks

Error: "Assertion failed [...]"

Hey! I'm unable to use the CLI command to output a screenshot. Here's my console output:

$ screenshot-tweet https://twitter.com/discordapp/status/1027365054792888321 output.png

> Screenshotting tweet "1027365054792888321" to "output.png"...
> Assertion failed: frame_header.payload_length == sizeof xfer_info, file src\win\pipe.c, line 1708

Changing the tweet url, the output format, or the output destination results in the same error.
My friend was able to run it without any issues, so I'm not too sure why it doesn't works on my end.

The package was installed via npm install -g screenshot-tweet

Always returning "Tweet doesnt exist"

I am attempting to use via API on my next.js site. I am running this on server side.

import screenshotTweet from "screenshot-tweet";

async function handleGetTweet() {
  try {
    let tweet = screenshotTweet("https://twitter.com/elonmusk/status/1312545997499719680")
  } catch (error) {
    console.error(error);
  }
};

Error: Tweet does not exist!

This happens for any tweet I try.

Invalid Tweet URL

It display in console log: "Invalid Tweet URL"
Tweet is exist and account is not private. why?

Does not seem to work on the command line any more

I have a fresh install of the latest Node and NPM with only screenshot-tweet added:

$ node -v
v10.15.1
martin@node-0:~$ npm -v
6.4.1
martin@node-0:~$ screenshot-tweet --version
1.1.1

When I try to do a screenshot of a tweet, it does not report an error, but it also does not create the image file:

$ screenshot-tweet https://twitter.com/BarackObama/status/1095882980839616512 /tmp/tweet.jpg
Screenshotting tweet "https://twitter.com/BarackObama/status/1095882980839616512" to "/tmp/tweet.jpg"...
$ ls -l /tmp/tweet.jpg
ls: cannot access '/tmp/tweet.jpg': No such file or directory

Could you shed some light on this, please? Thanks!

summary_large_image card not captured

Thanks for this handy tool! When testing the example tweet via

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

I get a summary card as expected, but tweets containing summary_large_image don’t seem to get captured, instead leaving a blank spot. For example:

screenshot-tweet https://twitter.com/ciotan/status/929937601225670657 tweet2.jpg

…returns this image:

tweet2

Everything else works fine. If you have any idea what I’m doing wrong, please let me know. Thanks!

% screenshot-tweet -v
1.0.4
% node -v
v8.9.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.