Skip to main content

Twitter thread to LinkedIn carousel in python

· 2 min read


In this blog post, I share how I built a Python tool that converts a Twitter thread into a LinkedIn carousel in seconds. This tool is open source and contributions for improvements are welcome.

The open source code is available here.

As content creators, it would be good if the same content could be utilised across every platform easily. Sometimes you need some tweaks based on audience, but often the same content is used across all platforms.

I noticed recently that LinkedIn carousels have been picking a lot of traction, and given I have some nice Twitter threads (example) I thought that it would be great if I could convert them into a LinkedIn carousel.

So, I looked for free tools and didn’t find anything good enough. I ended up using canvas to re-create the thread — which you can find here. It worked well, but it was time consuming and for most cases, I don’t want to be messing around with the design side of things.

image

As a true software engineer and pythonist, I obtained the Twitter API keys and built a tool that would convert a Twitter thread into a LinkedIn carousel in a matter of seconds.

And as usual, I open sourced it: https://github.com/DidierRLopes/thread-to-carousel.

This tool is far from perfect, and a lot can be improved on the design side of things to: Recognize emojis; Highlight mentions; Change the size of the box based on the text; Better text placement when images attached; Better URL link display.

The goal for me wasn’t to build a perfect tool, but something easy enough that did the job. And, as the project is open source, I expect to have users contributing to the script so that it can be improved over time.

Today I run it using:

python convert2carousel.py https://twitter.com/didier_lopes/status/1581247044228100096

And the result can be found here.

image

Feel free to check the project here and I look forward to having contributors helping me improve it!

As always, any feedback welcome 🙏🏽