Inspiration

Since the introduction of Twitter threads, there has been a steady increase in the number of threads created by users on a daily bases. With numerous threads to read, one may not always have the time to read long Twitter threads when they have other activities to carry out. This can break the reading flow and make them not to enjoy the threads.

With ThreadVoice, users are no longer limited to just text form of Twitter threads. Twitter threads can now be consumed in audio format. Users can listen to Twitter threads when they are in between activities or even driving. They can download and put audio threads in playlists to consume at their leisure time.
It is also useful to those who are visually impaired; who would otherwise not be able to easily access Twitter threads.

What it does

ThreadVoice is a Twitter bot built to help users convert Twitter threads into listenable audio via text-to-speech technology. The aim is to assist the visually impaired, those who prefer listening to reading and others who might not have the time to read long Twitter threads.

How to use it
If you encounter a Twitter Thread thread you wish to convert to audio,
Mention @Threadvoice in a reply to the Twitter thread.
The bot will reply with a link to the audio format of the thread.

How I built it

The bot makes use of the Twitter V2 API. It uses the Filtered stream endpoint to listen to its mentions in realtime.

When a user mentions the bot, it uses the Twitter V2 User Tweet timeline API to fetch tweets from the thread author's timeline. This way, we can process threads older than 7 days.
The thread is then reconstructed from the author's timeline. The formatted thread in text form is then passed to the Text-to-speech engine.
Once the thread is successfully converted to audio form, the bot will reply the user with a link to the audio file which can be streamed or downloaded to local storage.

The Text to Speech engine is powered by Amazon Polly, Google TTS, Microsoft TTS and Voice RSS. All are used interchangeably when appropriate.

Challenges we ran into

Twitter does not provide an easy way to access threads older than 7 days. I had to use the User Timeline endpoint to fetch and and reconstruct threads. This is limited to threads found in the author's most recent 3200 Tweets. However, if a user mentions the bot on the last tweet of a thread, there are no limitations as the in_reply_to_tweet_id is used to fetch the chain of thread.

Accomplishments that we're proud of

Threadvoice is positively welcomed by Twitter users.

What we learned

I learned more about the Text-to-speech technology and what it would take to run and train my own models. However, I didn't self-host the tech as it would be more computationally and financially expensive to run on my own.

What's next for ThreadVoice

  • Implement a podcast RSS feed.
  • Create a custom audio player.

Built With

Share this project:

Updates