/ home / code / a javascript implementation of twitter's text processing library /

A JavaScript implementation of Twitter's text processing library

11:14 pm, February 25, 2016 703 188 0.9 @ 200 wpmrate up KruXoR source

Original Post Date: 11:10 pm, July 21, 2014

Looks interesting and provides text processing, url extraction hashtag and user name processing.

A JavaScript utility that provides text processing routines for Tweets. This library conforms to a common test suite shared by many other implementations, particularly twitter-text.gem (Ruby). The library provides autolinking and extraction for URLs, usernames, lists, and hashtags.


Extraction Examples

// basic extraction
var usernames = twttr.txt.extractMentions("Mentioning @twitter and @jack")
// usernames == ["twitter", "jack"]

Auto-linking Examples

twttr.txt.autoLink("link @user, please #request");
twttr.txt.autoLink("link @user, and expand url... http://t.co/0JG5Mcq", { urlEntities: [ { "url": "http://t.co/0JG5Mcq", "display_url": "blog.twitter.com/2011/05/twitte…", "expanded_url": "http://blog.twitter.com/2011/05/twitter-for-mac-update.html", "indices": [ 30, 48 ] } ]});

See Tweet Entities for more info getting url entities from Twitter's API.

11:14 pm, February 25, 2016 703 188 source



Add Report



This is a site where i basically just post whatever i feel like at the time, it has no one particular topic but usually. Just my ideas and links and random bits of code that i find.

Follow Me..



Looking for the kruxor minecraft server mc.kruxor.com? we have migrated it to... icekraft.com if you want to play on there just connect to play.icekraft.com:25535 or mc.kruxor.com should also still work.

Favorite Links