Link Search Menu Expand Document

Screenshot a Tweet

Use the HTML/CSS to Image API to generate images of tweets.


How it works

To generate a screenshot of a Tweet, we can make use of the Twitter embed API.

For the image to work, make sure you set the selector param to .twitter-tweet and ms_delay to 1500. This gives the embed extra time to load and has the API properly crop the tweet.

Example code

Copy this example, and swap out the href to create an image of any tweet you’d like.

Generate a screenshot of a tweet.

HTML

<blockquote class="twitter-tweet" style="width: 400px;" data-dnt="true">
<p lang="en" dir="ltr"></p>

<a href="https://twitter.com/fortnitegame/status/1253524351376330752"></a>

</blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Important: set these parameters when creating the image.

  • selector: .twitter-tweet
  • ms_delay: 1500

Need help?

Talk to a human. Please email us support@htmlcsstoimage.com with any questions and we’ll gladly help you get started.


Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2020 Code Happy, LLC.

Page last modified: Oct 29 2020 at 02:54 PM.

Edit this page on GitHub.