Extract URLs, usernames, hashtags, etc. from tweets with twitter-text-js

If you ever have to work with Tweets, then twitter-text-js will surely come in handy:

A JavaScript utility that provides text processing routines for Tweets. The library provides autolinking and extraction for URLs, usernames, lists, and hashtags.

The following snippet for example will autolink the hashtag and the mentioned username:

twitter.autoLink(twitter.htmlEscape('#hello < @world >'))

Installation per NPM/Yarn:

npm install twitter-text

twitter-text-js (GitHub) →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.