This project is created using Canvas, Puppeteer, and Twitter API, initially created for integration with Github Profilinator( P.S. You can use it anywhere you want to add your Tweets in Image format 😉 ).
Note: The Heroku Dyno might be in Sleep mode, so retry after a few minutes in case the API didn't respond on first call
https://tweets-as-an-image.herokuapp.com/?twitterHandle={your_twitter_handle_here}
(Default count value: 1)https://tweets-as-an-image.herokuapp.com/?twitterHandle={your_twitter_handle_here}&count={number_of_tweets_you_want_to_fecth}
Replace your_twitter_handle_here
and number_of_tweets_you_want_to_fecth
accordingly.
- Retweets and comments are ignored.
- Using Twitter API requires developer account and there's a rate limit over Twitter API usage which is 900 per user and 1500 per app with a window length of 15 minutes. Find more here.
- So, for personal usage kindly please fork this repo and set up your own server on herokuapp
Steps to deploy your own fork:
- Create Developer Account on twitter.
- Register your app.
- Generate Bearer Token.
- Link your github repository on Heroku.
- Set environment variable TWITTER_OAUTH_TOKEN="Your bearer auth token".
- 🎉 Copy the deployed project and use it.(P.S. Don't forget to add twitter handle and count query at the end of url).
https://tweets-as-an-image.herokuapp.com/tweet?twitterHandle={your_twitter_handle}
https://tweets-as-an-image.herokuapp.com/tweet?twitterHandle={your_twitter_handle}&id={your_tweet_id}&theme={light_or_dark}&maxwidth={max_width_of_your_tweet_image}&height={height_of_the_image}&lang={language}
id
(User's Tweet ID, Default: user's last tweet)theme
(light or dark, Default: dark)maxwidth
(maxWidth of your tweet image(+10px for border will be added), Default: 550)height
(height of the image, Default: Min(2000, Height of your tweet))lang
(Languages Supported by twitter, check here, Default: en)
- This project is using oembed response of the tweets, and the height of the any tweets are not fixed, as there can be media content too, so it is not returned in the response. Read more about it here. I am evaluating the height in the puppeteer itself, which is set to Minimum of 2000px and Height of Your Tweet. If you want to clip the part of the tweet, you can pass height as an optional query.
- I am using Puppeteer, a headless Chromium based browser to load the oembed response and take the screenshot of it.
- The Deployement part on heroku is same as the above one, but you need to add
puppeteer buildpack
in the deployement. You can know more about that here
Liked the project? Hit the star button to support!
Found a bug ? Create an issue here